This commit is contained in:
insanity 2018-06-22 20:29:47 +09:00
commit f0c498c980
2 changed files with 43 additions and 7 deletions

View File

@ -5,6 +5,7 @@ import com.loafle.overflow.central.module.member.dao.MemberDAO;
import com.loafle.overflow.core.exception.OverflowException; import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.apikey.ApiKey; import com.loafle.overflow.model.apikey.ApiKey;
import com.loafle.overflow.model.domain.Domain;
import com.loafle.overflow.model.domain.DomainMember; import com.loafle.overflow.model.domain.DomainMember;
import com.loafle.overflow.model.email.EmailAuth; import com.loafle.overflow.model.email.EmailAuth;
import com.loafle.overflow.model.member.Member; import com.loafle.overflow.model.member.Member;
@ -13,6 +14,7 @@ import com.loafle.overflow.model.meta.MetaMemberStatus;
import com.loafle.overflow.service.central.apikey.ApiKeyService; import com.loafle.overflow.service.central.apikey.ApiKeyService;
import com.loafle.overflow.service.central.domain.DomainMemberService; import com.loafle.overflow.service.central.domain.DomainMemberService;
import com.loafle.overflow.service.central.domain.DomainService;
import com.loafle.overflow.service.central.email.EmailAuthService; import com.loafle.overflow.service.central.email.EmailAuthService;
import com.loafle.overflow.service.central.member.MemberService; import com.loafle.overflow.service.central.member.MemberService;
import com.loafle.overflow.service.central.probe.ProbeService; import com.loafle.overflow.service.central.probe.ProbeService;
@ -45,6 +47,9 @@ public class CentralMemberService implements MemberService {
@Autowired @Autowired
private DomainMemberService domainMemberService; private DomainMemberService domainMemberService;
@Autowired
private DomainService domainService;
@Autowired @Autowired
private ProbeService probeService; private ProbeService probeService;
@ -107,6 +112,8 @@ public class CentralMemberService implements MemberService {
Member resMember = this.memberDAO.save(member); Member resMember = this.memberDAO.save(member);
this.registDomainMember(member);
try { try {
this.emailAuthService.sendEmailByMember(resMember); this.emailAuthService.sendEmailByMember(resMember);
} catch (Exception e) { } catch (Exception e) {
@ -117,6 +124,34 @@ public class CentralMemberService implements MemberService {
return resMember; return resMember;
} }
private void registDomainMember(Member member) throws OverflowException {
if (null == member) {
throw new OverflowException("registDomainMember()", new Throwable());
}
String domainName = "";
if (null == member.getCompanyName() || member.getCompanyName().equals("")) {
String[] emails = member.getEmail().split("@");
int idx = emails[1].indexOf(".");
domainName = emails[1].substring(0, idx ) + "`s domain";
} else {
domainName = member.getCompanyName() + "`s Domain" ;
}
DomainMember domainMember = new DomainMember();
Domain domain = new Domain();
domain.setName(domainName);
this.domainService.regist(domain);
domainMember.setDomain(domain);
domainMember.setMember(member);
this.domainMemberService.regist(domainMember);
}
public Member sendEmailForPassword(String email) throws OverflowException { public Member sendEmailForPassword(String email) throws OverflowException {
Member member = this.memberDAO.findByEmail(email); Member member = this.memberDAO.findByEmail(email);

View File

@ -27,20 +27,21 @@
MemberTotpService totpService; MemberTotpService totpService;
// @Test @Test
// public void regist() throws Exception { public void regist() throws Exception {
// Member m = new Member(); // Member m = new Member();
// m.setPw("!@#$qwer1234"); // m.setPw("!@#$Qwer1234");
// m.setStatus(new MetaMemberStatus((short)1)); //// m.setStatus(new MetaMemberStatus((short)1));
// m.setMetaMemberStatus(MetaMemberStatus.Enum.NOAUTH.to());
// m.setCreateDate(new Date()); // m.setCreateDate(new Date());
// m.setCompanyName("Loafle"); //// m.setCompanyName("Loafle");
// m.setEmail("geekhot@hotmail.co.kr"); // m.setEmail("geekhot@hotmail.co.kr");
// m.setName("administrator"); // m.setName("administrator");
// m.setPhone("00000000"); // m.setPhone("00000000");
// //
// Member res = this.memberService.signup(m,"!@#$qwer1234"); // Member res = this.memberService.signup(m,"!@#$Qwer1234");
// Assert.assertNotNull(res); // Assert.assertNotNull(res);
// } }
@Test @Test
public void signin() throws Exception { public void signin() throws Exception {