This commit is contained in:
insanity 2018-06-15 18:11:59 +09:00
parent 57d82209d2
commit 40118b4d96
3 changed files with 10 additions and 11 deletions

View File

@ -72,7 +72,7 @@ public class CentralEmailAuthService implements EmailAuthService {
auth.setAuthConfirmDate(new Date()); auth.setAuthConfirmDate(new Date());
this.emailAuthDAO.save(auth); this.emailAuthDAO.save(auth);
auth.getMember().setMetaMemberStatus(new MetaMemberStatus((short) 2)); auth.getMember().setMetaMemberStatus(MetaMemberStatus.Enum.NORMAL.to());
this.memberDAO.save(auth.getMember()); this.memberDAO.save(auth.getMember());
Domain domain = new Domain(); Domain domain = new Domain();
@ -132,12 +132,12 @@ public class CentralEmailAuthService implements EmailAuthService {
} }
public EmailAuth sendEmailByMember(Member member) throws OverflowException { public EmailAuth sendEmailByMember(Member member) throws OverflowException {
return this.sendEMail(member, (short)1); return this.sendEMail(member, MetaEmailType.Enum.SIGNUP);
} }
// Todo Send Email Refactoring // Todo Send Email Refactoring
public EmailAuth sendEmailResetPassword(Member member) throws OverflowException { 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) { private boolean isValidateTime(EmailAuth auth) {
@ -161,7 +161,7 @@ public class CentralEmailAuthService implements EmailAuthService {
return true; 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 key = GenerateKey.getKey();
// String enMail = emailSender.encrypt(key); // String enMail = emailSender.encrypt(key);
@ -172,7 +172,7 @@ public class CentralEmailAuthService implements EmailAuthService {
EmailAuth auth = new EmailAuth(); EmailAuth auth = new EmailAuth();
auth.setMember(member); auth.setMember(member);
auth.setEmailAuthKey(key); auth.setEmailAuthKey(key);
auth.setMetaEmailType(new MetaEmailType(type)); auth.setMetaEmailType(emailType.to());
// System.out.println("encode = [" + encode + "]"); // System.out.println("encode = [" + encode + "]");
String encode = ""; String encode = "";
@ -183,11 +183,11 @@ public class CentralEmailAuthService implements EmailAuthService {
e.printStackTrace(); e.printStackTrace();
} }
if (type == 1) { if (emailType == MetaEmailType.Enum.SIGNUP) {
mailSubject = "Signup Confirm Mail"; mailSubject = "Signup Confirm Mail";
entry = "confirm-signup"; entry = "confirm-signup";
templateName = "/vmtemplates/signup.vm"; templateName = "/vmtemplates/signup.vm";
} else if (type == 2) { } else if (emailType == MetaEmailType.Enum.RESET_PASSWORD) {
mailSubject = "Reset Password Confirm Mail"; mailSubject = "Reset Password Confirm Mail";
entry = "confirm-reset-password"; entry = "confirm-reset-password";
templateName = "/vmtemplates/password_reset.vm"; templateName = "/vmtemplates/password_reset.vm";

View File

@ -57,7 +57,7 @@ public class CentralMemberService implements MemberService {
throw new OverflowException("SignInIdNotExistException()", new Throwable()); 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()); throw new OverflowException("EmailNotConfirmedException()", new Throwable());
} }
@ -100,7 +100,7 @@ public class CentralMemberService implements MemberService {
member.setPassword(passwordEncoder.encode(password)); member.setPassword(passwordEncoder.encode(password));
if (member.getMetaMemberStatus() == null) { if (member.getMetaMemberStatus() == null) {
member.setMetaMemberStatus(new MetaMemberStatus((short) 1)); member.setMetaMemberStatus(MetaMemberStatus.Enum.NOAUTH.to());
} }
member.setTotpType(false); member.setTotpType(false);

View File

@ -13,7 +13,6 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
/** /**
* Created by snoop on 17. 9. 14. * Created by snoop on 17. 9. 14.
@ -26,7 +25,7 @@ public class MetaTargetTypeDAOTest {
private MetaTargetTypeDAO metaTargetTypeDAO; private MetaTargetTypeDAO metaTargetTypeDAO;
@Test @Test
public void findTest() throws Exception { public void findAllByMetaInfraType() throws Exception {
List<MetaTargetType> metaTargetTypes = this.metaTargetTypeDAO List<MetaTargetType> metaTargetTypes = this.metaTargetTypeDAO
.findAllByMetaInfraType(MetaInfraType.Enum.SERVICE.to()); .findAllByMetaInfraType(MetaInfraType.Enum.SERVICE.to());