WANG há 6 anos atrás
pai
commit
69cad75776

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

@@ -112,9 +112,7 @@ public class AuthServiceImpl implements AuthService {
 		if (StringUtils.isBlank(accountValue)) {
 			throw new StatusException("B-001202", "accountValue is null");
 		}
-		if (StringUtils.isBlank(password)) {
-			throw new StatusException("B-001203", "password is null");
-		}
+
 		AccountType accountTypeEnum = null;
 		try {
 			accountTypeEnum = AccountType.valueOf(accountType);
@@ -194,6 +192,9 @@ public class AuthServiceImpl implements AuthService {
 			if (null != userEntity.getEnable() && !userEntity.getEnable()) {
 				throw new StatusException("B-001005", "账号被禁用");
 			}
+			if (StringUtils.isBlank(password)) {
+				throw new StatusException("B-001203", "账号或密码错误");
+			}
 			String rightPassword = userEntity.getPassword();
 			if (!rightPassword.equals(password)) {
 				whenPasswordError(accountTypeEnum, accountValue, clientIp);
@@ -237,6 +238,9 @@ public class AuthServiceImpl implements AuthService {
 			}
 			// 密码登录
 			else {
+				if (StringUtils.isBlank(password)) {
+					throw new StatusException("B-001203", "账号或密码错误");
+				}
 				String rightPassword = student.getPassword();
 				if (!rightPassword.equals(password)) {
 					whenPasswordError(accountTypeEnum, accountValue, clientIp);