Commit f80d13c8a604594835480e5acde7b5b4b447d979

Authored by Administrator
1 parent 5a391de7

123

common/models/Feedback.php
... ... @@ -24,19 +24,6 @@ class Feedback extends CoreFeedback
24 24 'required',
25 25 'on' => self::SCENARIO_DEFAULT,
26 26 ],
27   - [[
28   - 'reCaptcha'
29   - ],
30   - \himiklab\yii2\recaptcha\ReCaptchaValidator::className(),
31   -// 'secret' => '6LcmYmcUAAAAACVi_73RmSAIjJlw4BCgQpfUsrPs',
32   - 'secret' => '6LfWrmkUAAAAAAFJfjMieZs-EHblaqdt4sPZZqVZ',
33   - 'uncheckedMessage' => 'Please confirm that you are not a bot.',
34   -
35   - ],
36   - [
37   - ['reCaptcha'],
38   - 'required'
39   - ],
40 27 [
41 28 [
42 29 'name',
... ... @@ -53,6 +40,20 @@ class Feedback extends CoreFeedback
53 40 'required',
54 41 'on' => self::SCENARIO_CALLBACK,
55 42 ],
  43 + [[
  44 + 'reCaptcha'
  45 + ],
  46 + \himiklab\yii2\recaptcha\ReCaptchaValidator::className(),
  47 +// 'secret' => '6LcmYmcUAAAAACVi_73RmSAIjJlw4BCgQpfUsrPs',
  48 + 'secret' => '6LfWrmkUAAAAAAFJfjMieZs-EHblaqdt4sPZZqVZ',
  49 + 'uncheckedMessage' => 'Please confirm that you are not a bot.',
  50 +
  51 + ],
  52 + [
  53 + ['reCaptcha'],
  54 + 'required'
  55 + ],
  56 +
56 57 [
57 58 ['email'],
58 59 'email',
... ...
frontend/controllers/SiteController.php
... ... @@ -206,14 +206,15 @@
206 206 } else {
207 207 $model = new Feedback(
208 208 [
209   - 'scenario' => Feedback::SCENARIO_CONTACT,
  209 + 'scenario' => Feedback::SCENARIO_DEFAULT,
210 210 ]
211 211 );
212 212 if ($model->load(Yii::$app->request->post())) {
213   -
214   - if (empty($model->reCaptcha) || $model->reCaptcha == null || $model->reCaptcha == '')
  213 +
  214 + if ( $model->reCaptcha == null )
215 215 return [
216 216 'success' => 'false',
  217 + 'cap' => $model->reCaptcha,
217 218 'error' => 'You don`t confirm Recaptcha. Unblock JS to this'
218 219 ];
219 220 $model->save();
... ...