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