/** * 重置密码 * @param $token * @return string * @throws \yii\web\HttpException */ public function actionResetPassword($token) { $passwordReminder = PasswordReminder::findOne(['token' => $token]); if (is_null($passwordReminder)) { throw new NotFoundHttpException('请求页面不存在'); } $model = new SignUpForm(); $model->scenario = 'reset'; if ($model->load(Yii::$app->request->post()) && $model->resetPassword()) { //清掉$passwordReminder $passwordReminder->delete(); unset($passwordReminder); return $this->goHome(); } return $this->render('reset-password', ['model' => $model]); }