'error.password_required'], [['password'], 'validatePassword'], ]; } public function validatePassword() { if (!$this->getAccount()->validatePassword($this->password)) { $this->addError('password', 'error.password_invalid'); } } /** * @return \common\models\Account */ protected function getAccount() { return Yii::$app->user->identity; } }