Commit fe0fcefcfff448f2c44a77237b97ded7754c6d39
1 parent
2023a165
big commti
Showing
1 changed file
with
22 additions
and
0 deletions
Show diff stats
frontend/controllers/SiteController.php
| @@ -97,4 +97,26 @@ class SiteController extends Controller | @@ -97,4 +97,26 @@ class SiteController extends Controller | ||
| 97 | 'code'=>'404', | 97 | 'code'=>'404', |
| 98 | ]); | 98 | ]); |
| 99 | } | 99 | } |
| 100 | + /** | ||
| 101 | + * Requests password reset. | ||
| 102 | + * | ||
| 103 | + * @return mixed | ||
| 104 | + */ | ||
| 105 | + public function actionRequestPasswordReset() | ||
| 106 | + { | ||
| 107 | + $model = new PasswordResetRequestForm(); | ||
| 108 | + if ($model->load(Yii::$app->request->post()) && $model->validate()) { | ||
| 109 | + if ($model->sendEmail()) { | ||
| 110 | + Yii::$app->session->setFlash('success', 'Check your email for further instructions.'); | ||
| 111 | + | ||
| 112 | + return $this->goHome(); | ||
| 113 | + } else { | ||
| 114 | + Yii::$app->session->setFlash('error', 'Sorry, we are unable to reset password for email provided.'); | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + return $this->render('requestPasswordResetToken', [ | ||
| 119 | + 'model' => $model, | ||
| 120 | + ]); | ||
| 121 | + } | ||
| 100 | } | 122 | } |