修复AccessToken、RefreshToken均可更新Token的问题

This commit is contained in:
BBIT-Kai
2025-12-29 16:28:10 +08:00
parent e6a9a09492
commit e1fcc64236
@@ -149,7 +149,7 @@ fun Application.User(config: AppConfig) {
message = "拿什么乱七八糟的东西跟我换Access Token呢,???",
data = null
)
}
} else {
val userId = UUID.fromString(decodedJWT.getClaim("user_id").asString())
// 生成新的access token和refresh token
BaseResponse(
@@ -158,6 +158,7 @@ fun Application.User(config: AppConfig) {
generateRefreshToken(config, userId)
)
)
}
} catch (ex: Exception) {
BaseResponse(status = false, message = "token解析错误", data = null)
}
@@ -166,7 +167,6 @@ fun Application.User(config: AppConfig) {
authenticate {
get("/getUserInfo") {
val userId = getUserIdByToken(call)
if (userId != null) {
val userInfo = UserDAO.getUserInfoByUserId(userId)
if (userInfo != null) {
val response = BaseResponse(data = userInfo)
@@ -174,9 +174,6 @@ fun Application.User(config: AppConfig) {
} else {
call.respond(BaseResponse(data = "查无此人"))
}
} else {
call.respond(BaseResponse(data = "Token出错"))
}
}
}
}