119
*
элемент
@return
широкого
mixed
*/
управление
public
являясь
function actionRequestPasswordReset()
{
развивающейся
$model
обеспечивающие
= new PasswordResetRequestForm();
if
первой
($model->load(Yii::$app->request->post())
сопровождаются
&& $model->validate()) {
if ($model->sendEmail()) {
Yii::$app->session->setFlash('success', Yii::t('app', 'Check your email for further
instructions.'));
return $this->goHome();
} else {
Yii::$app->session->setFlash('error', Yii::t('app', 'Sorry, we are unable to reset
password for email provided.'));
}
}
return $this->render('requestPasswordResetToken', [
'model' => $model,
]);
}
/**
* Resets password.
*
* @param string $token
* @return mixed
* @throws BadRequestHttpException
*/
public function actionResetPassword($token)
{
try {
$model = new ResetPasswordForm($token);
} catch (InvalidParamException $e) {
throw new BadRequestHttpException($e->getMessage());
}
if ($model->load(Yii::$app->request->post()) && $model->validate() && $model-
>resetPassword()) {
Yii::$app->session->setFlash('success', Yii::t('app', 'New password was saved.'));
return $this->goHome();
}
return $this->render('resetPassword', [
'model' => $model,
]);
}
}