Merge remote-tracking branch 'origin/master'

This commit is contained in:
snoop 2017-08-23 17:38:33 +09:00
commit 36678b25c7
2 changed files with 29 additions and 8 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. 23.
*/
public class EqualsOldPasswordException extends OverflowRuntimeException {
public EqualsOldPasswordException() {
super();
}
public EqualsOldPasswordException(String message) {
super(message);
}
}

View File

@ -2,10 +2,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.exception.*;
import com.loafle.overflow.module.member.model.Member;
import com.loafle.overflow.module.meta.model.MetaMemberStatus;
import org.springframework.beans.factory.annotation.Autowired;
@ -70,21 +67,29 @@ public class MemberService {
// Todo websocket session remove
}
public Member modify(Member member) {
public Member modify(Member member, String pw) {
Member preMember = this.memberDAO.findByEmail(member.getEmail());
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
member.setPw(passwordEncoder.encode(pw));
Boolean match = passwordEncoder.matches(member.getPw(), preMember.getPw());
if(!match) {
throw new SignInPwNotMatchException();
if(match) {
throw new EqualsOldPasswordException();
}
return this.memberDAO.save(member);
}
public Member read(long memberId) {
return this.memberDAO.findOne(memberId);
if (memberId <= 0) {
// Todo MemberId null Exception
}
Member resMember = this.memberDAO.findOne(memberId);
return resMember;
}
public void withdrawal(Member member) {