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;
|
||||
|
||||
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.meta.model.MetaMemberStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -16,20 +19,22 @@ public class MemberService {
|
|||
@Autowired
|
||||
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);
|
||||
|
||||
if ( null == m ) {
|
||||
return m;
|
||||
throw new SignInIdNotExistException();
|
||||
}
|
||||
|
||||
if ( m.getStatus().getId() == 1 ) {
|
||||
throw new Exception("Email Auth Confirm Check");
|
||||
throw new EmailNotConfirmedException();
|
||||
}
|
||||
|
||||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||
Boolean match = passwordEncoder.matches(signinPw, m.getPw());
|
||||
if(!match) return null;
|
||||
if(!match) {
|
||||
throw new SignInPwNotExactException();
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
|
|
@ -88,6 +88,9 @@ public class ServiceProxy {
|
|||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
responseObserver.onError(e);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
responseObserver.onError(e);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user