joined email check

noauth prove regist for probe
This commit is contained in:
geek 2017-08-18 14:51:46 +09:00
parent 4d00504612
commit 368e89df18
3 changed files with 44 additions and 2 deletions

View File

@ -0,0 +1,16 @@
package com.loafle.overflow.module.member.exception;
import com.loafle.overflow.commons.exception.OverflowRuntimeException;
/**
* Created by geek on 17. 8. 18.
*/
public class JoinedEmailException extends OverflowRuntimeException {
public JoinedEmailException() {
super();
}
public JoinedEmailException(String message) {
super(message);
}
}

View File

@ -3,6 +3,7 @@ package com.loafle.overflow.module.member.service;
import com.loafle.overflow.module.email.service.EmailAuthService;
import com.loafle.overflow.module.member.dao.MemberDAO;
import com.loafle.overflow.module.member.exception.EmailNotConfirmedException;
import com.loafle.overflow.module.member.exception.JoinedEmailException;
import com.loafle.overflow.module.member.exception.SignInIdNotExistException;
import com.loafle.overflow.module.member.exception.SignInPwNotMatchException;
import com.loafle.overflow.module.member.model.Member;
@ -45,6 +46,12 @@ public class MemberService {
public Member signup(Member member) {
Member isMember = this.memberDAO.findByEmail(member.getEmail());
if (null != isMember && isMember.getId() > 0) {
throw new JoinedEmailException();
}
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
member.setPw(passwordEncoder.encode(member.getPw()));

View File

@ -1,11 +1,15 @@
package com.loafle.overflow.module.noauthprobe.service;
import com.loafle.overflow.module.domain.model.Domain;
import com.loafle.overflow.module.member.model.Member;
import com.loafle.overflow.module.noauthprobe.dao.NoAuthProbeDAO;
import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe;
import com.loafle.overflow.module.probe.model.Probe;
import com.loafle.overflow.module.probe.service.ProbeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
@ -17,6 +21,8 @@ public class NoAuthProbeService {
@Autowired
private NoAuthProbeDAO noAuthProbeDAO;
@Autowired
private ProbeService probeService;
public NoAuthProbe regist(NoAuthProbe noAuthProbe) {
@ -32,8 +38,21 @@ public class NoAuthProbeService {
return this.noAuthProbeDAO.findOne(id);
}
public List<NoAuthProbe> registForNoAuthProbes(List<NoAuthProbe> noAuthProbes) {
public void registForNoAuthProbes(List<NoAuthProbe> noAuthProbes) {
// Todo encryption key generation & probe key generation
// Todo domain injection & member injection
// List<Probe> resProbe = new ArrayList<>();
Probe probe = null;
for (NoAuthProbe noAuth : noAuthProbes) {
probe = new Probe();
probe.setProbeKey(noAuth.getApiKey());
probe.setDomain(new Domain(1));
probe.setAuthorizeMember(new Member(1));
// resProbe.add(probe);
this.probeService.regist(probe);
}
return this.noAuthProbeDAO.save(noAuthProbes);
}
}