diff --git a/api/controllers/AuthenticationController.php b/api/controllers/AuthenticationController.php index 125066b..07555d6 100644 --- a/api/controllers/AuthenticationController.php +++ b/api/controllers/AuthenticationController.php @@ -69,7 +69,7 @@ class AuthenticationController extends Controller { 'errors' => $this->normalizeModelErrors($model->getErrors()), ]; - if (ArrayHelper::getValue($data['errors'], 'login') === 'error.email_frequency') { + if (ArrayHelper::getValue($data['errors'], 'login') === 'error.recently_sent_message') { $emailActivation = $model->getEmailActivation(); $data['data'] = [ 'canRepeatIn' => $emailActivation->canRepeatIn(), diff --git a/api/models/authentication/ForgotPasswordForm.php b/api/models/authentication/ForgotPasswordForm.php index f1102b2..78f2757 100644 --- a/api/models/authentication/ForgotPasswordForm.php +++ b/api/models/authentication/ForgotPasswordForm.php @@ -46,7 +46,7 @@ class ForgotPasswordForm extends ApiForm { if (!$this->hasErrors()) { $emailConfirmation = $this->getEmailActivation(); if ($emailConfirmation !== null && !$emailConfirmation->canRepeat()) { - $this->addError($attribute, 'error.email_frequency'); + $this->addError($attribute, 'error.recently_sent_message'); } } } diff --git a/api/models/authentication/RegistrationForm.php b/api/models/authentication/RegistrationForm.php index 574ceb5..61d066a 100644 --- a/api/models/authentication/RegistrationForm.php +++ b/api/models/authentication/RegistrationForm.php @@ -27,7 +27,7 @@ class RegistrationForm extends ApiForm { public function rules() { return [ [[], ReCaptchaValidator::class, 'message' => 'error.captcha_invalid', 'when' => !YII_ENV_TEST], - ['rulesAgreement', 'required', 'message' => 'error.you_must_accept_rules'], + ['rulesAgreement', 'required', 'message' => 'error.rulesAgreement_required'], ['username', 'validateUsername', 'skipOnEmpty' => false], ['email', 'validateEmail', 'skipOnEmpty' => false], diff --git a/api/models/base/KeyConfirmationForm.php b/api/models/base/KeyConfirmationForm.php index bc23c73..07f50eb 100644 --- a/api/models/base/KeyConfirmationForm.php +++ b/api/models/base/KeyConfirmationForm.php @@ -13,7 +13,7 @@ class KeyConfirmationForm extends ApiForm { public function rules() { return [ // TODO: нужно провалидировать количество попыток ввода кода для определённого IP адреса и в случае чего запросить капчу - ['key', 'required', 'message' => 'error.key_is_required'], + ['key', 'required', 'message' => 'error.key_required'], ['key', EmailActivationKeyValidator::class], ]; } diff --git a/tests/codeception/api/functional/EmailConfirmationCest.php b/tests/codeception/api/functional/EmailConfirmationCest.php index 1fe0dc0..2f4e8da 100644 --- a/tests/codeception/api/functional/EmailConfirmationCest.php +++ b/tests/codeception/api/functional/EmailConfirmationCest.php @@ -13,7 +13,7 @@ class EmailConfirmationCest { $I->canSeeResponseContainsJson([ 'success' => false, 'errors' => [ - 'key' => 'error.key_is_required', + 'key' => 'error.key_required', ], ]); diff --git a/tests/codeception/api/functional/ForgotPasswordCest.php b/tests/codeception/api/functional/ForgotPasswordCest.php index c39662d..5f36a93 100644 --- a/tests/codeception/api/functional/ForgotPasswordCest.php +++ b/tests/codeception/api/functional/ForgotPasswordCest.php @@ -39,7 +39,7 @@ class ForgotPasswordCest { $I->canSeeResponseContainsJson([ 'success' => false, 'errors' => [ - 'login' => 'error.email_frequency', + 'login' => 'error.recently_sent_message', ], ]); $I->canSeeResponseJsonMatchesJsonPath('$.data.canRepeatIn'); diff --git a/tests/codeception/api/functional/RegisterCest.php b/tests/codeception/api/functional/RegisterCest.php index 608bb7c..210afb3 100644 --- a/tests/codeception/api/functional/RegisterCest.php +++ b/tests/codeception/api/functional/RegisterCest.php @@ -18,7 +18,7 @@ class RegisterCest { public function testIncorrectRegistration(FunctionalTester $I) { $route = new SignupRoute($I); - $I->wantTo('get error.you_must_accept_rules if we don\'t accept rules'); + $I->wantTo('get error.rulesAgreement_required if we don\'t accept rules'); $route->register([ 'username' => 'ErickSkrauch', 'email' => 'erickskrauch@ely.by', @@ -28,17 +28,17 @@ class RegisterCest { $I->canSeeResponseContainsJson([ 'success' => false, 'errors' => [ - 'rulesAgreement' => 'error.you_must_accept_rules', + 'rulesAgreement' => 'error.rulesAgreement_required', ], ]); - $I->wantTo('don\'t see error.you_must_accept_rules if we accept rules'); + $I->wantTo('don\'t see error.rulesAgreement_requireds if we accept rules'); $route->register([ 'rulesAgreement' => true, ]); $I->cantSeeResponseContainsJson([ 'errors' => [ - 'rulesAgreement' => 'error.you_must_accept_rules', + 'rulesAgreement' => 'error.rulesAgreement_required', ], ]); diff --git a/tests/codeception/api/unit/models/authentication/ForgotPasswordFormTest.php b/tests/codeception/api/unit/models/authentication/ForgotPasswordFormTest.php index a5edf8b..cd9f568 100644 --- a/tests/codeception/api/unit/models/authentication/ForgotPasswordFormTest.php +++ b/tests/codeception/api/unit/models/authentication/ForgotPasswordFormTest.php @@ -79,7 +79,7 @@ class ForgotPasswordFormTest extends DbTestCase { ]); $model->validateFrequency('login'); - expect($model->getErrors('login'))->equals(['error.email_frequency']); + expect($model->getErrors('login'))->equals(['error.recently_sent_message']); }); $this->specify('empty errors if email was sent a long time ago', function() {