feat: There is no way the
This commit is contained in:
@@ -84,11 +84,11 @@ public class UserUtils {
|
||||
* 获取当前登录用户名
|
||||
*/
|
||||
public static String getUserName() {
|
||||
// JWTRealm.Principal principal = (Principal) SecurityUtils.getSubject().getPrincipal();
|
||||
// if (principal != null) {
|
||||
// return principal.getLoginName();
|
||||
// }
|
||||
return jwtUtils.getUserIdByToken();
|
||||
UserEO userEO = getUser();
|
||||
if (userEO != null) {
|
||||
return userEO.getAccount();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,11 +96,7 @@ public class UserUtils {
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String getUserId() {
|
||||
UserEO userEO = getUser();
|
||||
if (userEO != null) {
|
||||
return userEO.getUsid();
|
||||
}
|
||||
return null;
|
||||
return jwtUtils.getUserIdByToken();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,13 +106,15 @@ public class UserUtils {
|
||||
UserEO user = jwtUtils.getUserByToken();
|
||||
if (user == null) {
|
||||
user = new UserEO();
|
||||
String userName = getUserName();
|
||||
String userId = getUserId();
|
||||
|
||||
if (StringUtils.isNotEmpty(userName)) {
|
||||
UserEO userInDb = userService.getUserByLoginNameNotDeleted(userName);
|
||||
user = ObjectUtil.clone(userInDb);
|
||||
user.setPassword("");
|
||||
CacheUtils.putCache(CURRENT_USER, user);
|
||||
if (StringUtils.isNotEmpty(userId)) {
|
||||
List<UserEO> userEOS = userService.getUser(userId);
|
||||
if(!userEOS.isEmpty()){
|
||||
user = ObjectUtil.clone(userEOS.get(0));
|
||||
user.setPassword("");
|
||||
CacheUtils.putCache(CURRENT_USER, user);
|
||||
}
|
||||
}
|
||||
}
|
||||
return user;
|
||||
|
||||
Reference in New Issue
Block a user