diff --git a/common/models/Feedback.php b/common/models/Feedback.php index 88d3fd6..4438276 100644 --- a/common/models/Feedback.php +++ b/common/models/Feedback.php @@ -24,19 +24,6 @@ class Feedback extends CoreFeedback 'required', 'on' => self::SCENARIO_DEFAULT, ], - [[ - 'reCaptcha' - ], - \himiklab\yii2\recaptcha\ReCaptchaValidator::className(), -// 'secret' => '6LcmYmcUAAAAACVi_73RmSAIjJlw4BCgQpfUsrPs', - 'secret' => '6LfWrmkUAAAAAAFJfjMieZs-EHblaqdt4sPZZqVZ', - 'uncheckedMessage' => 'Please confirm that you are not a bot.', - - ], - [ - ['reCaptcha'], - 'required' - ], [ [ 'name', @@ -53,6 +40,20 @@ class Feedback extends CoreFeedback 'required', 'on' => self::SCENARIO_CALLBACK, ], + [[ + 'reCaptcha' + ], + \himiklab\yii2\recaptcha\ReCaptchaValidator::className(), +// 'secret' => '6LcmYmcUAAAAACVi_73RmSAIjJlw4BCgQpfUsrPs', + 'secret' => '6LfWrmkUAAAAAAFJfjMieZs-EHblaqdt4sPZZqVZ', + 'uncheckedMessage' => 'Please confirm that you are not a bot.', + + ], + [ + ['reCaptcha'], + 'required' + ], + [ ['email'], 'email', diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index 0ec2cee..1543c68 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -206,14 +206,15 @@ } else { $model = new Feedback( [ - 'scenario' => Feedback::SCENARIO_CONTACT, + 'scenario' => Feedback::SCENARIO_DEFAULT, ] ); if ($model->load(Yii::$app->request->post())) { - - if (empty($model->reCaptcha) || $model->reCaptcha == null || $model->reCaptcha == '') + + if ( $model->reCaptcha == null ) return [ 'success' => 'false', + 'cap' => $model->reCaptcha, 'error' => 'You don`t confirm Recaptcha. Unblock JS to this' ]; $model->save(); -- libgit2 0.21.4