修复了登录完以后token不失效的bug
This commit is contained in:
parent
85cd31247c
commit
73ce32d5e7
|
@ -3,9 +3,12 @@ package net.maku.maku.controller;
|
|||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.maku.framework.common.cache.RedisCache;
|
||||
import net.maku.framework.common.exception.ErrorCode;
|
||||
import net.maku.framework.common.exception.ServerException;
|
||||
import net.maku.framework.common.utils.PageResult;
|
||||
import net.maku.framework.common.utils.Result;
|
||||
import net.maku.maku.convert.TUserConvert;
|
||||
|
@ -75,6 +78,10 @@ public class TUserController {
|
|||
public Result<TUserEntity> findByUsername(HttpServletRequest request){
|
||||
String token = request.getHeader("token");
|
||||
TUserEntity entity = (TUserEntity) redisCache.get(token);
|
||||
if(ObjectUtils.isNull(entity)){
|
||||
throw new ServerException(ErrorCode.REFRESH_TOKEN_INVALID);
|
||||
}
|
||||
|
||||
return Result.ok(entity);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ public class TUserEntity {
|
|||
|
||||
private String username;
|
||||
|
||||
|
||||
private String password;
|
||||
|
||||
private String avatar;
|
||||
|
@ -28,6 +29,10 @@ public class TUserEntity {
|
|||
|
||||
private Integer status;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String email;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
|
Loading…
Reference in New Issue
Block a user