当前位置: 首页>>代码示例>>PHP>>正文


PHP ResetPasswordForm::validate方法代码示例

本文整理汇总了PHP中frontend\models\ResetPasswordForm::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP ResetPasswordForm::validate方法的具体用法?PHP ResetPasswordForm::validate怎么用?PHP ResetPasswordForm::validate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在frontend\models\ResetPasswordForm的用法示例。


在下文中一共展示了ResetPasswordForm::validate方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionResetPassword

 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]);
 }
开发者ID:KanKai,项目名称:dsale2015,代码行数:13,代码来源:UserController.php

示例2: actionResetPassword

 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', 'Your password has been reset successfully.');
         return $this->redirect(array('/auth/login/'));
     }
     return $this->render('resetPassword', ['model' => $model]);
 }
开发者ID:rubedkhan2149,项目名称:2149,代码行数:13,代码来源:LoginController.php

示例3: actionResetConfirm

 /**
  * set new password
  * @param $token
  * @return string|\yii\web\Response
  */
 public function actionResetConfirm($token)
 {
     $this->layout = 'login';
     $model = new ResetPasswordForm();
     $account = Account::findByPasswordResetToken($token);
     if ($account) {
         if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->setPassword($account)) {
             Yii::$app->getSession()->setFlash('success', Yii::t('app', 'New password was saved.'));
             return $this->redirect(['/account/login']);
         }
     }
     return $this->render('reset-confirm', ['model' => $model, 'account' => $account]);
 }
开发者ID:modernkernel,项目名称:yii2-skeleton,代码行数:18,代码来源:AccountController.php

示例4: actionResetPassword

 public function actionResetPassword($token)
 {
     try {
         $model = new ResetPasswordForm($token);
     } catch (InvalidParamException $e) {
         Yii::$app->getSession()->setFlash('danger', ['type' => 'danger', 'duration' => 5000, 'icon' => 'glyphicon glyphicon-exclamation-sign', 'message' => 'Parámetro inválido', 'title' => 'Reestablecer contraseña', 'positonY' => 'top', 'positonX' => 'center']);
         return $this->goHome();
         //throw new BadRequestHttpException($e->getMessage()); al mostrar el error lo hace en el layout main en vez de landing
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
         Yii::$app->getSession()->setFlash('success', ['type' => 'success', 'duration' => 5000, 'icon' => 'glyphicon glyphicon-user', 'message' => 'La contraseña se ha guardado con éxito.', 'title' => 'Reestablecer contraseña', 'positonY' => 'top', 'positonX' => 'center']);
         return $this->goHome();
     }
     $user = User::findByPasswordResetToken($token);
     if (!$user) {
         throw new InvalidParamException('Wrong password reset token.');
     }
     return $this->renderAjax('resetPassword', ['model' => $model, 'user' => $user]);
 }
开发者ID:vilariel,项目名称:remisesramallo,代码行数:19,代码来源:HomeController.php

示例5: actionResetPassword

 /**
  * Resets password.
  *
  * @param string $token
  * @return mixed
  */
 public function actionResetPassword($token)
 {
     $model = new ResetPasswordForm(['token' => $token]);
     if (!$model->validate(['token'])) {
         Yii::$app->session->addFlash('error', Yii::t('authorization', 'Wrong password reset token provided. {0}', [Html::a(Yii::t('authorization', 'Resend?'), ['site/request-password-reset'])]));
         return $this->goHome();
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
         Yii::$app->session->addFlash('success', Yii::t('frontend', 'New password was saved. You can login now.'));
         return $this->redirect(['login']);
     }
     return $this->render('resetPassword', ['model' => $model]);
 }
开发者ID:WondersLabCorporation,项目名称:yii2,代码行数:19,代码来源:SiteController.php

示例6: actionResetPassword

 /**
  * 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());
     }
     $this->layout = 'empty_layout';
     if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
         Yii::$app->session->setFlash('success', 'Новый пароль сохранен.');
         return $this->goHome();
     }
     return $this->render('resetPassword', ['model' => $model]);
 }
开发者ID:MaxFlower,项目名称:kklk,代码行数:21,代码来源:SiteController.php

示例7: actionResetPassword

 public function actionResetPassword()
 {
     $model = new ResetPasswordForm();
     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]);
 }
开发者ID:dalinhuang,项目名称:wethepeople,代码行数:9,代码来源:ProfileController.php

示例8: actionResetPassword

 public function actionResetPassword($token)
 {
     $this->title = '重置密码' . ' - ' . Yii::$app->name;
     $this->description = '';
     try {
         $model = new ResetPasswordForm($token);
     } catch (InvalidParamException $e) {
         throw new NotFoundHttpException($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]);
 }
开发者ID:npk,项目名称:v2sex,代码行数:15,代码来源:AccountController.php

示例9: actionChangePassword

 public function actionChangePassword()
 {
     $request = wanhunet::$app->request;
     if ($request->isPost) {
         $resetPass = new ResetPasswordForm($request->post());
         if ($resetPass->validate()) {
             if ($resetPass->save()) {
                 return $this->goBack(['info' => '修改成功'], Url::to(['site/setup']));
             }
         } else {
             if ($resetPass->hasErrors()) {
                 return $this->goBack(['info' => current($resetPass->getFirstErrors())], Url::to(['site/change-password']));
             }
         }
     }
     return $this->view('change_password');
 }
开发者ID:suyuanen,项目名称:p2p,代码行数:17,代码来源:SiteController.php

示例10: actionResetPassword

 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(['/main/login']);
         }
     }
     return $this->render('resetPassword', ['model' => $model]);
 }
开发者ID:baranov-nt,项目名称:some-2,代码行数:15,代码来源:MainController.php

示例11: actionResetPassword

 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', 'Пароль успешно изменён.');
         return $this->redirect('/site/login');
     }
     return $this->render('resetPassword', ['model' => $model]);
 }
开发者ID:KPEMATOP,项目名称:findspree_old,代码行数:13,代码来源:SiteController.php

示例12: actionResetPassword

 /**
  * 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()) {
         Alert::add(Yii::t('msg', 'New password was saved. Now you can log in.'));
         return $this->goHome();
     }
     return $this->render('resetPassword', ['model' => $model]);
 }
开发者ID:jedzura,项目名称:nzs,代码行数:20,代码来源:SiteController.php


注:本文中的frontend\models\ResetPasswordForm::validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。