diff --git a/framework/gateway/src/main/java/io/metersphere/gateway/controller/LoginController.java b/framework/gateway/src/main/java/io/metersphere/gateway/controller/LoginController.java index 4d1f784d5b..87503c3256 100644 --- a/framework/gateway/src/main/java/io/metersphere/gateway/controller/LoginController.java +++ b/framework/gateway/src/main/java/io/metersphere/gateway/controller/LoginController.java @@ -78,7 +78,7 @@ public class LoginController { @PostMapping(value = "/signin") @MsAuditLog(module = OperLogModule.AUTH_TITLE, type = OperLogConstants.LOGIN, title = "登录") public Mono login(@RequestBody LoginRequest request, WebSession session, Locale locale) { - return Mono.defer(() -> userLoginService.login(request, session, locale).map(Mono::just).orElseGet(Mono::empty)) + return Mono.just(userLoginService.login(request, session, locale)) .subscribeOn(Schedulers.boundedElastic()) .switchIfEmpty(Mono.error(new ResponseStatusException(HttpStatus.BAD_REQUEST, "Not found user info or invalid password"))) .map(ResultHolder::success) diff --git a/framework/gateway/src/main/java/io/metersphere/gateway/log/aspect/MsLogAspect.java b/framework/gateway/src/main/java/io/metersphere/gateway/log/aspect/MsLogAspect.java index 489c58fa4e..64603038dd 100644 --- a/framework/gateway/src/main/java/io/metersphere/gateway/log/aspect/MsLogAspect.java +++ b/framework/gateway/src/main/java/io/metersphere/gateway/log/aspect/MsLogAspect.java @@ -113,8 +113,9 @@ public class MsLogAspect { if (arg instanceof WebSession session) { Object user = session.getAttribute("user"); if (user != null) { - String username = (String) MethodUtils.invokeExactMethod(user, "getName"); - msOperLog.setOperUser(username); + String userId = (String) MethodUtils.invokeExactMethod(user, "getId"); + msOperLog.setOperUser(userId); + msOperLog.setCreateUser(userId); } break; }