joined email check
noauth prove regist for probe
This commit is contained in:
parent
4d00504612
commit
368e89df18
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package com.loafle.overflow.module.member.service;
|
||||||
import com.loafle.overflow.module.email.service.EmailAuthService;
|
import com.loafle.overflow.module.email.service.EmailAuthService;
|
||||||
import com.loafle.overflow.module.member.dao.MemberDAO;
|
import com.loafle.overflow.module.member.dao.MemberDAO;
|
||||||
import com.loafle.overflow.module.member.exception.EmailNotConfirmedException;
|
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.SignInIdNotExistException;
|
||||||
import com.loafle.overflow.module.member.exception.SignInPwNotMatchException;
|
import com.loafle.overflow.module.member.exception.SignInPwNotMatchException;
|
||||||
import com.loafle.overflow.module.member.model.Member;
|
import com.loafle.overflow.module.member.model.Member;
|
||||||
|
@ -45,6 +46,12 @@ public class MemberService {
|
||||||
|
|
||||||
public Member signup(Member member) {
|
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();
|
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
member.setPw(passwordEncoder.encode(member.getPw()));
|
member.setPw(passwordEncoder.encode(member.getPw()));
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
package com.loafle.overflow.module.noauthprobe.service;
|
package com.loafle.overflow.module.noauthprobe.service;
|
||||||
|
|
||||||
import com.loafle.overflow.module.domain.model.Domain;
|
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.dao.NoAuthProbeDAO;
|
||||||
import com.loafle.overflow.module.noauthprobe.model.NoAuthProbe;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,6 +21,8 @@ public class NoAuthProbeService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private NoAuthProbeDAO noAuthProbeDAO;
|
private NoAuthProbeDAO noAuthProbeDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProbeService probeService;
|
||||||
|
|
||||||
public NoAuthProbe regist(NoAuthProbe noAuthProbe) {
|
public NoAuthProbe regist(NoAuthProbe noAuthProbe) {
|
||||||
|
|
||||||
|
@ -32,8 +38,21 @@ public class NoAuthProbeService {
|
||||||
return this.noAuthProbeDAO.findOne(id);
|
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user