mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 20:19:16 +08:00
fix: 修复登录后操作日志没有记录操作人的问题
--bug=1031897 --user=刘瑞斌 【系统设置】github#27080,登录日志无操作人 https://www.tapd.cn/55049933/s/1427027
This commit is contained in:
parent
f08185f191
commit
ec9b01c773
@ -78,7 +78,7 @@ public class LoginController {
|
|||||||
@PostMapping(value = "/signin")
|
@PostMapping(value = "/signin")
|
||||||
@MsAuditLog(module = OperLogModule.AUTH_TITLE, type = OperLogConstants.LOGIN, title = "登录")
|
@MsAuditLog(module = OperLogModule.AUTH_TITLE, type = OperLogConstants.LOGIN, title = "登录")
|
||||||
public Mono<ResultHolder> login(@RequestBody LoginRequest request, WebSession session, Locale locale) {
|
public Mono<ResultHolder> 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())
|
.subscribeOn(Schedulers.boundedElastic())
|
||||||
.switchIfEmpty(Mono.error(new ResponseStatusException(HttpStatus.BAD_REQUEST, "Not found user info or invalid password")))
|
.switchIfEmpty(Mono.error(new ResponseStatusException(HttpStatus.BAD_REQUEST, "Not found user info or invalid password")))
|
||||||
.map(ResultHolder::success)
|
.map(ResultHolder::success)
|
||||||
|
@ -113,8 +113,9 @@ public class MsLogAspect {
|
|||||||
if (arg instanceof WebSession session) {
|
if (arg instanceof WebSession session) {
|
||||||
Object user = session.getAttribute("user");
|
Object user = session.getAttribute("user");
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
String username = (String) MethodUtils.invokeExactMethod(user, "getName");
|
String userId = (String) MethodUtils.invokeExactMethod(user, "getId");
|
||||||
msOperLog.setOperUser(username);
|
msOperLog.setOperUser(userId);
|
||||||
|
msOperLog.setCreateUser(userId);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user