Форма инициализации смены 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() { public function rules() {
return [ return [
[['password'], 'required', 'message' => 'error.{attribute}_required'], [['password'], 'required', 'message' => 'error.password_required'],
[['password'], 'validatePassword'], [['password'], 'validatePassword'],
]; ];
} }

View File

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