Skip to content

Commit

Permalink
使用redis时,有时候removeUser会失效,removeSession总可以了吧
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou-hao committed Apr 10, 2017
1 parent 00b3690 commit 0a2839a
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
* 授权控制器,用于登录系统
Expand Down Expand Up @@ -115,10 +116,12 @@ public ResponseMessage onlineInfo() {
*/
@RequestMapping(value = "/exit", method = RequestMethod.POST)
@AccessLogger("登出")
public ResponseMessage exit() {
public ResponseMessage exit(HttpSession session) {
User user = WebUtil.getLoginUser();
if (user != null) {
httpSessionManager.removeUser(user.getId());
//使用redis时,有时候removeUser会失效,removeSession总可以了吧
httpSessionManager.removeSession(session.getId());
}
return ResponseMessage.ok();
}
Expand Down

0 comments on commit 0a2839a

Please sign in to comment.