mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Образован валидатор EmailValidator
This commit is contained in:
@ -9,6 +9,7 @@ use common\models\Account;
|
||||
use common\models\confirmations\RegistrationConfirmation;
|
||||
use common\models\EmailActivation;
|
||||
use common\models\UsernameHistory;
|
||||
use common\validators\EmailValidator;
|
||||
use common\validators\LanguageValidator;
|
||||
use common\validators\PasswordValidate;
|
||||
use common\validators\UsernameValidator;
|
||||
@ -42,7 +43,7 @@ class RegistrationForm extends ApiForm {
|
||||
['rulesAgreement', 'required', 'message' => E::RULES_AGREEMENT_REQUIRED],
|
||||
|
||||
['username', UsernameValidator::class],
|
||||
['email', 'validateEmail', 'skipOnEmpty' => false],
|
||||
['email', EmailValidator::class],
|
||||
|
||||
['password', 'required', 'message' => E::PASSWORD_REQUIRED],
|
||||
['rePassword', 'required', 'message' => E::RE_PASSWORD_REQUIRED],
|
||||
@ -54,14 +55,6 @@ class RegistrationForm extends ApiForm {
|
||||
];
|
||||
}
|
||||
|
||||
public function validateEmail() {
|
||||
$account = new Account();
|
||||
$account->email = $this->email;
|
||||
if (!$account->validate(['email'])) {
|
||||
$this->addErrors($account->getErrors());
|
||||
}
|
||||
}
|
||||
|
||||
public function validatePasswordAndRePasswordMatch($attribute) {
|
||||
if (!$this->hasErrors()) {
|
||||
if ($this->password !== $this->rePassword) {
|
||||
|
Reference in New Issue
Block a user