diff --git a/src/main/java/com/loafle/overflow/central/module/email/service/CentralEmailAuthService.java b/src/main/java/com/loafle/overflow/central/module/email/service/CentralEmailAuthService.java index 22eb276..42ac395 100644 --- a/src/main/java/com/loafle/overflow/central/module/email/service/CentralEmailAuthService.java +++ b/src/main/java/com/loafle/overflow/central/module/email/service/CentralEmailAuthService.java @@ -72,7 +72,7 @@ public class CentralEmailAuthService implements EmailAuthService { auth.setAuthConfirmDate(new Date()); this.emailAuthDAO.save(auth); - auth.getMember().setMetaMemberStatus(new MetaMemberStatus((short) 2)); + auth.getMember().setMetaMemberStatus(MetaMemberStatus.Enum.NORMAL.to()); this.memberDAO.save(auth.getMember()); Domain domain = new Domain(); @@ -132,12 +132,12 @@ public class CentralEmailAuthService implements EmailAuthService { } public EmailAuth sendEmailByMember(Member member) throws OverflowException { - return this.sendEMail(member, (short)1); + return this.sendEMail(member, MetaEmailType.Enum.SIGNUP); } // Todo Send Email Refactoring public EmailAuth sendEmailResetPassword(Member member) throws OverflowException { - return this.sendEMail(member, (short)2); + return this.sendEMail(member, MetaEmailType.Enum.RESET_PASSWORD); } private boolean isValidateTime(EmailAuth auth) { @@ -161,7 +161,7 @@ public class CentralEmailAuthService implements EmailAuthService { return true; } - private EmailAuth sendEMail(Member member, Short type) throws OverflowException { + private EmailAuth sendEMail(Member member, MetaEmailType.Enum emailType) throws OverflowException { String key = GenerateKey.getKey(); // String enMail = emailSender.encrypt(key); @@ -172,7 +172,7 @@ public class CentralEmailAuthService implements EmailAuthService { EmailAuth auth = new EmailAuth(); auth.setMember(member); auth.setEmailAuthKey(key); - auth.setMetaEmailType(new MetaEmailType(type)); + auth.setMetaEmailType(emailType.to()); // System.out.println("encode = [" + encode + "]"); String encode = ""; @@ -183,11 +183,11 @@ public class CentralEmailAuthService implements EmailAuthService { e.printStackTrace(); } - if (type == 1) { + if (emailType == MetaEmailType.Enum.SIGNUP) { mailSubject = "Signup Confirm Mail"; entry = "confirm-signup"; templateName = "/vmtemplates/signup.vm"; - } else if (type == 2) { + } else if (emailType == MetaEmailType.Enum.RESET_PASSWORD) { mailSubject = "Reset Password Confirm Mail"; entry = "confirm-reset-password"; templateName = "/vmtemplates/password_reset.vm"; diff --git a/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java b/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java index deb32a1..4f97518 100644 --- a/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java +++ b/src/main/java/com/loafle/overflow/central/module/member/service/CentralMemberService.java @@ -57,7 +57,7 @@ public class CentralMemberService implements MemberService { throw new OverflowException("SignInIdNotExistException()", new Throwable()); } - if (m.getMetaMemberStatus().getId() == 1) { + if (m.getMetaMemberStatus().getId() == MetaMemberStatus.Enum.NOAUTH.getValue()) { throw new OverflowException("EmailNotConfirmedException()", new Throwable()); } @@ -100,7 +100,7 @@ public class CentralMemberService implements MemberService { member.setPassword(passwordEncoder.encode(password)); if (member.getMetaMemberStatus() == null) { - member.setMetaMemberStatus(new MetaMemberStatus((short) 1)); + member.setMetaMemberStatus(MetaMemberStatus.Enum.NOAUTH.to()); } member.setTotpType(false); diff --git a/src/test/java/com/loafle/overflow/central/module/meta/dao/MetaTargetTypeDAOTest.java b/src/test/java/com/loafle/overflow/central/module/meta/dao/MetaTargetTypeDAOTest.java index 6b9eb77..fd40e05 100644 --- a/src/test/java/com/loafle/overflow/central/module/meta/dao/MetaTargetTypeDAOTest.java +++ b/src/test/java/com/loafle/overflow/central/module/meta/dao/MetaTargetTypeDAOTest.java @@ -13,7 +13,6 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; /** * Created by snoop on 17. 9. 14. @@ -26,7 +25,7 @@ public class MetaTargetTypeDAOTest { private MetaTargetTypeDAO metaTargetTypeDAO; @Test - public void findTest() throws Exception { + public void findAllByMetaInfraType() throws Exception { List metaTargetTypes = this.metaTargetTypeDAO .findAllByMetaInfraType(MetaInfraType.Enum.SERVICE.to());