From e1121e9cd7d7cd65a423326f7ddf527aaa07d1d6 Mon Sep 17 00:00:00 2001 From: msksbr515 Date: Fri, 22 May 2026 18:32:20 +0800 Subject: [PATCH] style(auth): reorganize imports and reformat controller comments --- .../kotlin/com/msksbr/bookmgr/controller/AuthController.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/kotlin/com/msksbr/bookmgr/controller/AuthController.kt b/src/main/kotlin/com/msksbr/bookmgr/controller/AuthController.kt index 533f9f5..eafe002 100644 --- a/src/main/kotlin/com/msksbr/bookmgr/controller/AuthController.kt +++ b/src/main/kotlin/com/msksbr/bookmgr/controller/AuthController.kt @@ -9,6 +9,7 @@ import com.msksbr.bookmgr.template.Result import jakarta.servlet.http.HttpServletRequest import jakarta.validation.Valid import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestAttribute import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RestController @@ -75,8 +76,12 @@ class AuthController( */ @PostMapping("/logout") fun logout( + @RequestAttribute(required = false) username: String?, request: HttpServletRequest ): Result { + if (username != null) { + log.info("[Auth] logout username: {}", username) + } log.info("[Auth] logout: ip={}", ipExtractor.getRealIp(request)) log.debug("[Auth] user agent: {}", request.getHeader("User-Agent")) // JWT 无状态,登出只需客户端删除 token