fix: 修改退出账号功能
This commit is contained in:
parent
3b6496773d
commit
42de3bd79c
@ -31,9 +31,6 @@ public class LoginController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private LoginService loginService;
|
private LoginService loginService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private LogoutSuccessHandlerImpl logoutSuccessHandler;
|
|
||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
@ApiOperation(value = "登录")
|
@ApiOperation(value = "登录")
|
||||||
public ResponseResult login(HttpServletRequest request, @RequestBody LoginParam loginParam) {
|
public ResponseResult login(HttpServletRequest request, @RequestBody LoginParam loginParam) {
|
||||||
|
@ -14,5 +14,4 @@ public interface LoginService {
|
|||||||
|
|
||||||
ResponseResult login(HttpServletRequest request, LoginParam loginParam);
|
ResponseResult login(HttpServletRequest request, LoginParam loginParam);
|
||||||
|
|
||||||
ResponseResult logout();
|
|
||||||
}
|
}
|
||||||
|
@ -50,14 +50,4 @@ public class LoginServiceImpl implements LoginService {
|
|||||||
return new ResponseResult(200,"登录成功",map);
|
return new ResponseResult(200,"登录成功",map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResponseResult logout() {
|
|
||||||
//获取SecurityContextHolder中的用户id
|
|
||||||
UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
|
|
||||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
|
||||||
String userid = loginUser.getSysUserEntity().getId().toString();
|
|
||||||
//删除redis中的值
|
|
||||||
redisTemplate.delete("login:"+userid);
|
|
||||||
return new ResponseResult(200,"注销成功");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user