예제 #1
0
 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');
 }