Форма инициализации смены E-mail адреса теперь требует ввода пароля

This commit is contained in:
ErickSkrauch 2016-05-22 21:36:02 +03:00
parent ad42411a89
commit c34f0947ad
2 changed files with 4 additions and 5 deletions

View File

@ -9,7 +9,7 @@ class PasswordProtectedForm extends ApiForm {
public function rules() {
return [
[['password'], 'required', 'message' => 'error.{attribute}_required'],
[['password'], 'required', 'message' => 'error.password_required'],
[['password'], 'validatePassword'],
];
}

View File

@ -1,7 +1,6 @@
<?php
namespace api\models\profile\ChangeEmail;
use api\models\base\ApiForm;
use common\models\Account;
use common\models\confirmations\CurrentEmailConfirmation;
use common\models\EmailActivation;
@ -10,7 +9,7 @@ use yii\base\ErrorException;
use yii\base\Exception;
use yii\base\InvalidConfigException;
class InitStateForm extends ApiForm {
class InitStateForm extends \api\models\base\PasswordProtectedForm {
public $email;
@ -27,9 +26,9 @@ class InitStateForm extends ApiForm {
public function rules() {
// TODO: поверить наличие уже отправленных подтверждений смены E-mail
return [
return array_merge(parent::rules(), [
['!email', 'validateAccountPasswordHashStrategy', 'skipOnEmpty' => false],
];
]);
}
public function validateAccountPasswordHashStrategy($attribute) {