|
@@ -204,11 +204,7 @@ public class AuthServiceImpl implements AuthService {
|
|
if (StringUtils.isBlank(password)) {
|
|
if (StringUtils.isBlank(password)) {
|
|
throw new StatusException("B-001203", "账号或密码错误");
|
|
throw new StatusException("B-001203", "账号或密码错误");
|
|
}
|
|
}
|
|
- String rightPassword = userEntity.getPassword();
|
|
|
|
- if (!rightPassword.equals(password)) {
|
|
|
|
- whenLoginError(accountTypeEnum, accountValue, clientIp);
|
|
|
|
- throw new StatusException("B-001003", "账号或密码错误");
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
user.setUserId(userEntity.getId());
|
|
user.setUserId(userEntity.getId());
|
|
user.setUserType(UserType.COMMON);
|
|
user.setUserType(UserType.COMMON);
|
|
user.setDisplayName(userEntity.getLoginName() + " (" + userEntity.getName() + ")");
|
|
user.setDisplayName(userEntity.getLoginName() + " (" + userEntity.getName() + ")");
|
|
@@ -216,6 +212,21 @@ public class AuthServiceImpl implements AuthService {
|
|
|
|
|
|
List<Role> roleList = getUserRoles(userEntity.getId());
|
|
List<Role> roleList = getUserRoles(userEntity.getId());
|
|
user.setRoleList(roleList);
|
|
user.setRoleList(roleList);
|
|
|
|
+
|
|
|
|
+ if (isSuperAdmin(user)) {
|
|
|
|
+ byte[] bytes = SHA256.encode(userEntity.getLoginName() + password);
|
|
|
|
+ String encodePassword = ByteUtil.toHexAscii(bytes);
|
|
|
|
+ if (!encodePassword.equals(userEntity.getPassword())) {
|
|
|
|
+ whenLoginError(accountTypeEnum, accountValue, clientIp);
|
|
|
|
+ throw new StatusException("B-001003", "账号或密码错误");
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (!password.equals(userEntity.getPassword())) {
|
|
|
|
+ whenLoginError(accountTypeEnum, accountValue, clientIp);
|
|
|
|
+ throw new StatusException("B-001003", "账号或密码错误");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
// 学生学号登录
|
|
// 学生学号登录
|
|
if (AccountType.STUDENT_CODE.equals(accountTypeEnum)) {
|
|
if (AccountType.STUDENT_CODE.equals(accountTypeEnum)) {
|