public function actionResetPassword() { $model = new ResetPasswordForm(); if ($model->load(Yii::$app->request->post())) { if ($model->validate()) { $model->resetPassword(); Yii::$app->getSession()->setFlash('error', 'Your password was changed successfully.'); return $this->goHome(); } } return $this->render('resetPassword', ['model' => $model]); }
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->getSession()->setFlash('success', 'New password was saved.'); return $this->goHome(); } return $this->render('resetPassword', ['model' => $model]); }
public function actionResetPassword($id) { $isSuccessfull = false; $model = new ResetPasswordForm(); $model->id = $id; if ($model->load(Yii::$app->request->post()) && $model->validate()) { //send forgot password retrieval email to the client $isSuccessfull = true; $user = User::find()->where(['authKey' => $model->id])->one(); $user->password = $model->password; $user->save(false); } return $this->render('resetPassword', ['model' => $model, 'success' => $isSuccessfull]); }
public function actionResetPassword($key) { try { $model = new ResetPasswordForm($key); } catch (InvalidParamException $e) { throw new BadRequestHttpException($e->getMessage()); } if ($model->load(Yii::$app->request->post())) { if ($model->validate() && $model->resetPassword()) { Yii::$app->getSession()->setFlash('warning', 'Пароль изменен.'); return $this->redirect(['/site/login']); } } return $this->render('resetPassword', ['model' => $model]); }
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->getSession()->setFlash('success', 'A nova password foi salva com sucesso.'); return $this->redirect('/site/message'); } return $this->render('resetPassword', ['model' => $model]); }
public function actionResetPassword($token) { try { $model = new ResetPasswordForm($token); } catch (InvalidParamException $e) { return $this->render('opResult', ['title' => '密码重置失败', 'status' => 'warning', 'msg' => $e->getMessage()]); } if ($model->load(Yii::$app->getRequest()->post()) && $model->validate() && $model->resetPassword()) { return $this->render('opResult', ['title' => '密码重置成功', 'status' => 'success', 'msg' => '新密码已生效']); } return $this->render('resetPassword', ['model' => $model]); }
public function actionChange_password() { Yii::$app->util->tab = 5; $user = Yii::$app->user->identity; $token = Yii::$app->security->generateRandomString() . '_' . time(); //echo $token; exit(0); $user->password_reset_token = $token; $user->save(); Yii::$app->util->member = $user; 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->getSession()->setFlash('success', 'New password was saved.'); return $this->goHome(); } return $this->render('_change_password', ['model' => $model, 'user' => $user]); }
public function actionResetPassword() { $get = Yii::$app->request->get(); $token = false; if (isset($get['token'])) { $token = $get['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->getSession()->setFlash('success', 'Спасибо! Пароль успешно изменён.'); return $this->goHome(); } return $this->render('resetPassword', ['model' => $model]); }