fix: 修改退出账号功能

This commit is contained in:
weihongyang 2022-06-23 12:09:55 +08:00
джерело 3b6496773d
коміт 42de3bd79c
3 змінених файлів з 0 додано та 14 видалено

@ -31,9 +31,6 @@ public class LoginController {
@Autowired
private LoginService loginService;
@Autowired
private LogoutSuccessHandlerImpl logoutSuccessHandler;
@PostMapping("/login")
@ApiOperation(value = "登录")
public ResponseResult login(HttpServletRequest request, @RequestBody LoginParam loginParam) {

@ -14,5 +14,4 @@ public interface LoginService {
ResponseResult login(HttpServletRequest request, LoginParam loginParam);
ResponseResult logout();
}

@ -50,14 +50,4 @@ public class LoginServiceImpl implements LoginService {
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,"注销成功");
}
}