فهرست منبع

FIX: email registration

guoyc 8 سال پیش
والد
کامیت
20a6b7057c

+ 6 - 6
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/web/logic/impl/AccountLogicImpl.java

@@ -243,19 +243,19 @@ public class AccountLogicImpl implements AccountLogic {
         }
 
         if (accountVO.getUserType() == UserType.WORKER.getValue()) {
-            if (!EmailValidator.getInstance().isValid(accountVO.getManager().getEmail())) {
+            if (!EmailValidator.getInstance().isValid(accountVO.getWorker().getEmail())) {
                 throw new HttpBadRequestException("Invalid email");
             }
-            if (managerService.getManagerByEmail(accountVO.getManager().getEmail()) != null) {
-                throw new HttpBadRequestException("Manager already exists");
+            if (workerService.getWorkerByEmail(accountVO.getWorker().getEmail()) != null) {
+                throw new HttpBadRequestException("Worker already exists");
             }
             accountVO.getWorker().setMobile(null);
         } else if (accountVO.getUserType() == UserType.MANAGER.getValue()) {
-            if (!EmailValidator.getInstance().isValid(accountVO.getWorker().getEmail())) {
+            if (!EmailValidator.getInstance().isValid(accountVO.getManager().getEmail())) {
                 throw new HttpBadRequestException("Invalid email");
             }
-            if (workerService.getWorkerByEmail(accountVO.getWorker().getEmail()) != null) {
-                throw new HttpBadRequestException("Worker already exists");
+            if (managerService.getManagerByEmail(accountVO.getManager().getEmail()) != null) {
+                throw new HttpBadRequestException("Manager already exists");
             }
             accountVO.getManager().setMobile(null);
         } else {