public function actionReset() { $token = trim($_GET['token']); $model = new ResetPasswordForm(); if (isset($_POST['ResetPasswordForm'])) { $model->attributes = $_POST['ResetPasswordForm']; if ($model->validate() && $model->reset()) { $str = '密码重置成功,请试着登录下!'; Yii::app()->user->setFlash('success', $str); $this->redirect(array('s/signin')); } } else { $record = User::model()->findByAttributes(array('token' => $token)); $model->token = $record->token; if ($record == null) { throw new CHttpException(404, 'The requested Reset Password does not exist.'); exit; } } $this->_pageTitle = '重新设置密码' . API::lchart(); $this->render('reset', array('record' => $record, 'model' => $model)); }
public function actionReset() { $token = trim($_GET['token']); $model = new ResetPasswordForm(); if (isset($_POST['ResetPasswordForm'])) { $model->attributes = $_POST['ResetPasswordForm']; if ($model->validate() && $model->reset()) { echo 'reset ok'; } } else { $record = User::model()->findByAttributes(array('token' => $token)); $model->token = $record->token; if ($record == null) { echo 'f**k'; exit; } } $this->render('reset', array('record' => $record, 'model' => $model)); }