diff --git a/api/controllers/SignupController.php b/api/controllers/SignupController.php index e338f17..2518b5e 100644 --- a/api/controllers/SignupController.php +++ b/api/controllers/SignupController.php @@ -61,7 +61,7 @@ class SignupController extends Controller { 'errors' => $this->normalizeModelErrors($model->getErrors()), ]; - if ($response['errors']['email'] === E::RECENTLY_SENT_MESSAGE) { + if (ArrayHelper::getValue($response['errors'], 'email') === E::RECENTLY_SENT_MESSAGE) { $activation = $model->getActivation(); $response['data'] = [ 'canRepeatIn' => $activation->canRepeatIn(), diff --git a/api/models/authentication/RegistrationForm.php b/api/models/authentication/RegistrationForm.php index 67cdd62..04accb4 100644 --- a/api/models/authentication/RegistrationForm.php +++ b/api/models/authentication/RegistrationForm.php @@ -19,16 +19,23 @@ use yii\base\InvalidConfigException; class RegistrationForm extends ApiForm { + public $captcha; + public $username; + public $email; + public $password; + public $rePassword; + public $rulesAgreement; + public $lang; public function rules() { return [ - [[], ReCaptchaValidator::class, 'message' => E::CAPTCHA_INVALID, 'when' => !YII_ENV_TEST], + ['captcha', ReCaptchaValidator::class], ['rulesAgreement', 'required', 'message' => E::RULES_AGREEMENT_REQUIRED], ['username', 'validateUsername', 'skipOnEmpty' => false], diff --git a/api/models/authentication/RepeatAccountActivationForm.php b/api/models/authentication/RepeatAccountActivationForm.php index 18a7136..6041f33 100644 --- a/api/models/authentication/RepeatAccountActivationForm.php +++ b/api/models/authentication/RepeatAccountActivationForm.php @@ -1,6 +1,7 @@ 'trim'], ['email', 'required', 'message' => E::EMAIL_REQUIRED], ['email', 'validateEmailForAccount'], @@ -26,7 +30,7 @@ class RepeatAccountActivationForm extends ApiForm { } public function validateEmailForAccount($attribute) { - if (!$this->hasErrors($attribute)) { + if (!$this->hasErrors()) { $account = $this->getAccount(); if ($account === null) { $this->addError($attribute, E::EMAIL_NOT_FOUND); @@ -40,7 +44,7 @@ class RepeatAccountActivationForm extends ApiForm { } public function validateExistsActivation($attribute) { - if (!$this->hasErrors($attribute)) { + if (!$this->hasErrors()) { $activation = $this->getActivation(); if ($activation !== null && !$activation->canRepeat()) { $this->addError($attribute, E::RECENTLY_SENT_MESSAGE);