Merge remote-tracking branch 'origin/master'

This commit is contained in:
snoop 2017-08-21 13:59:42 +09:00
commit a422808cf2
4 changed files with 53 additions and 3 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()));
@ -65,6 +72,14 @@ public class MemberService {
public Member modify(Member member) {
Member preMember = this.memberDAO.findByEmail(member.getEmail());
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
Boolean match = passwordEncoder.matches(member.getPw(), preMember.getPw());
if(!match) {
throw new SignInPwNotMatchException();
}
return this.memberDAO.save(member);
}

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);
}
}

View File

@ -79,7 +79,7 @@ public class NoAuthProbeServiceTest {
List<NoAuthProbe> noAuthProbes = new ArrayList<NoAuthProbe>();
noAuthProbes.add(noAuthProbe);
List<NoAuthProbe> dd = this.noAuthProbeService.registForNoAuthProbes(noAuthProbes);
// List<NoAuthProbe> dd = this.noAuthProbeService.registForNoAuthProbes(noAuthProbes);
// System.out.println(dd.get(0).getId());