fix: 修改退出账号功能

This commit is contained in:
weihongyang 2022-06-23 12:09:55 +08:00
parent 3b6496773d
commit 42de3bd79c
3 changed files with 0 additions and 14 deletions

View File

@ -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) {

View File

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

View File

@ -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,"注销成功");
}
}