Exceptions of MemberService has been added.
This commit is contained in:
parent
cd512a38a4
commit
a07d063be1
|
@ -0,0 +1,4 @@
|
||||||
|
package com.loafle.overflow.commons.exception;
|
||||||
|
|
||||||
|
public class OverflowException extends Exception {
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
package com.loafle.overflow.module.member.exception;
|
||||||
|
|
||||||
|
import com.loafle.overflow.commons.exception.OverflowException;
|
||||||
|
|
||||||
|
public class EmailNotConfirmedException extends OverflowException {
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
package com.loafle.overflow.module.member.exception;
|
||||||
|
|
||||||
|
import com.loafle.overflow.commons.exception.OverflowException;
|
||||||
|
|
||||||
|
public class SignInIdNotExistException extends OverflowException {
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
package com.loafle.overflow.module.member.exception;
|
||||||
|
|
||||||
|
import com.loafle.overflow.commons.exception.OverflowException;
|
||||||
|
|
||||||
|
public class SignInPwNotExactException extends OverflowException {
|
||||||
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
package com.loafle.overflow.module.member.service;
|
package com.loafle.overflow.module.member.service;
|
||||||
|
|
||||||
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.SignInIdNotExistException;
|
||||||
|
import com.loafle.overflow.module.member.exception.SignInPwNotExactException;
|
||||||
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;
|
||||||
|
@ -16,20 +19,22 @@ public class MemberService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private MemberDAO memberDAO;
|
private MemberDAO memberDAO;
|
||||||
|
|
||||||
public Member signin(String signinId, String signinPw) throws Exception {
|
public Member signin(String signinId, String signinPw) throws SignInIdNotExistException, EmailNotConfirmedException, SignInPwNotExactException {
|
||||||
Member m = this.memberDAO.findByEmail(signinId);
|
Member m = this.memberDAO.findByEmail(signinId);
|
||||||
|
|
||||||
if ( null == m ) {
|
if ( null == m ) {
|
||||||
return m;
|
throw new SignInIdNotExistException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m.getStatus().getId() == 1 ) {
|
if ( m.getStatus().getId() == 1 ) {
|
||||||
throw new Exception("Email Auth Confirm Check");
|
throw new EmailNotConfirmedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
Boolean match = passwordEncoder.matches(signinPw, m.getPw());
|
Boolean match = passwordEncoder.matches(signinPw, m.getPw());
|
||||||
if(!match) return null;
|
if(!match) {
|
||||||
|
throw new SignInPwNotExactException();
|
||||||
|
}
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,9 @@ public class ServiceProxy {
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
responseObserver.onError(e);
|
responseObserver.onError(e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
responseObserver.onError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user