Prechádzať zdrojové kódy

第三方跳转登录密码问题

deason 4 rokov pred
rodič
commit
8620b87abb

+ 3 - 3
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/AuthServiceImpl.java

@@ -205,7 +205,7 @@ public class AuthServiceImpl implements AuthService {
             if (isSuperAdmin(user)) {
                 byte[] bytes = SHA256.encode(userEntity.getLoginName() + password);
                 String encodePassword = ByteUtil.toHexAscii(bytes);
-                if (!encodePassword.equals(userEntity.getPassword())) {
+                if (!password.equals(userEntity.getPassword()) && !encodePassword.equals(userEntity.getPassword())) {
                     whenLoginError(accountTypeEnum, accountValue, clientIp);
                     throw new StatusException("003003", "账号或密码错误");
                 }
@@ -220,7 +220,7 @@ public class AuthServiceImpl implements AuthService {
                 }
                 byte[] bytes = SHA256.encode(userEntity.getLoginName() + password);
                 String encodePassword = ByteUtil.toHexAscii(bytes);
-                if (!encodePassword.equals(userEntity.getPassword())) {
+                if (!password.equals(userEntity.getPassword()) && !encodePassword.equals(userEntity.getPassword())) {
                     whenLoginError(accountTypeEnum, accountValue, clientIp);
                     throw new StatusException("003003", "账号或密码错误");
                 }
@@ -275,7 +275,7 @@ public class AuthServiceImpl implements AuthService {
                 }
                 byte[] bytes = SHA256.encode(student.getIdentityNumber() + password);
                 String encodePassword = ByteUtil.toHexAscii(bytes);
-                if (!encodePassword.equals(student.getPassword())) {
+                if (!password.equals(student.getPassword()) && !encodePassword.equals(student.getPassword())) {
                     whenLoginError(accountTypeEnum, accountValue, clientIp);
                     throw new StatusException("003003", "账号或密码错误");
                 }