mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Образован хелпер Error, в который вынесены все коды ошибок.
Подкорректирован errorDict на фронте
This commit is contained in:
@@ -22,11 +22,11 @@ class ConfirmNewEmailForm extends KeyConfirmationForm {
|
||||
/**
|
||||
* @return Account
|
||||
*/
|
||||
public function getAccount() {
|
||||
public function getAccount() : Account {
|
||||
return $this->account;
|
||||
}
|
||||
|
||||
public function changeEmail() {
|
||||
public function changeEmail() : bool {
|
||||
if (!$this->validate()) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ class InitStateForm extends PasswordProtectedForm {
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
public function getAccount() {
|
||||
public function getAccount() : Account {
|
||||
return $this->account;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class InitStateForm extends PasswordProtectedForm {
|
||||
]);
|
||||
}
|
||||
|
||||
public function sendCurrentEmailConfirmation() {
|
||||
public function sendCurrentEmailConfirmation() : bool {
|
||||
if (!$this->validate()) {
|
||||
return false;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ class InitStateForm extends PasswordProtectedForm {
|
||||
* @return CurrentEmailConfirmation
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function createCode() {
|
||||
public function createCode() : CurrentEmailConfirmation {
|
||||
$account = $this->getAccount();
|
||||
$emailActivation = new CurrentEmailConfirmation();
|
||||
$emailActivation->account_id = $account->id;
|
||||
|
@@ -2,6 +2,7 @@
|
||||
namespace api\models\profile\ChangeEmail;
|
||||
|
||||
use api\models\base\KeyConfirmationForm;
|
||||
use common\helpers\Error as E;
|
||||
use common\models\Account;
|
||||
use common\models\confirmations\NewEmailConfirmation;
|
||||
use common\models\EmailActivation;
|
||||
@@ -33,7 +34,7 @@ class NewEmailForm extends KeyConfirmationForm {
|
||||
|
||||
public function rules() {
|
||||
return array_merge(parent::rules(), [
|
||||
['email', 'required', 'message' => 'error.email_required'],
|
||||
['email', 'required', 'message' => E::EMAIL_REQUIRED],
|
||||
['email', 'validateEmail'],
|
||||
]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user