示例#1
0
 public function logout()
 {
     if (is_login()) {
         $user = new UserApi();
         $user->logout();
         $this->success('退出成功!', U('login'));
     } else {
         $this->redirect("Index/index");
     }
 }
示例#2
0
 /**
  * 修改密码提交
  * @author
  */
 public function profile()
 {
     if (IS_POST) {
         if (!($uid = is_login())) {
             $this->ajaxError("您还没有登陆,请先登陆");
         }
         //获取参数
         $password = I("post.old");
         $repassword = I("post.repassword");
         $data["password"] = I("post.password");
         empty($password) && $this->ajaxError("请输入原密码");
         empty($data["password"]) && $this->ajaxError("请输入新密码");
         empty($repassword) && $this->ajaxError("请输入确认密码");
         if ($data["password"] !== $repassword) {
             $this->ajaxError("您输入的新密码与确认密码不一致");
         }
         $Api = new UserApi();
         $res = $Api->updateInfo($uid, $password, $data);
         if ($res['status']) {
             $Api->logout();
             $this->ajaxSuccess("修改密码成功!请重新登录");
         } else {
             $this->ajaxError($res["info"]);
         }
     } else {
         if (!($uid = is_login())) {
             $this->error("您还没有登陆,请先登陆", U('/'), 2);
         }
         $this->meta_title = '修改密码';
         $this->display();
     }
 }
示例#3
0
 public function logout()
 {
     $user = new UserApi();
     $user->logout();
     if (session('user_auth_sign') == NULL) {
         $this->success('登出成功!', U('login'));
     } else {
         $this->error('登出失败!');
     }
 }