pw exception
This commit is contained in:
parent
e3ad2b7876
commit
1b81edaeaf
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,10 +2,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.*;
|
||||||
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;
|
import com.loafle.overflow.module.member.model.Member;
|
||||||
import com.loafle.overflow.module.meta.model.MetaMemberStatus;
|
import com.loafle.overflow.module.meta.model.MetaMemberStatus;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -70,21 +67,29 @@ public class MemberService {
|
||||||
// Todo websocket session remove
|
// Todo websocket session remove
|
||||||
}
|
}
|
||||||
|
|
||||||
public Member modify(Member member) {
|
public Member modify(Member member, String pw) {
|
||||||
|
|
||||||
Member preMember = this.memberDAO.findByEmail(member.getEmail());
|
Member preMember = this.memberDAO.findByEmail(member.getEmail());
|
||||||
|
|
||||||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
|
member.setPw(passwordEncoder.encode(pw));
|
||||||
Boolean match = passwordEncoder.matches(member.getPw(), preMember.getPw());
|
Boolean match = passwordEncoder.matches(member.getPw(), preMember.getPw());
|
||||||
if(!match) {
|
if(match) {
|
||||||
throw new SignInPwNotMatchException();
|
throw new EqualsOldPasswordException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.memberDAO.save(member);
|
return this.memberDAO.save(member);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Member read(long memberId) {
|
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) {
|
public void withdrawal(Member member) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user