This commit is contained in:
geek 2018-04-24 18:53:01 +09:00
parent 2f3fb05b67
commit 389d62184f
2 changed files with 8 additions and 7 deletions

View File

@ -2,6 +2,7 @@ package com.loafle.overflow.central.module.member.service;
import com.loafle.overflow.central.commons.stereotype.WebappAPI;
import com.loafle.overflow.central.commons.utils.EmailSender;
import com.loafle.overflow.central.module.email.service.EmailAuthService;
import com.loafle.overflow.central.module.member.dao.MemberDAO;
import com.loafle.overflow.central.module.member.exception.*;

View File

@ -28,11 +28,11 @@ public class CentralMemberTotpService implements MemberTotpService {
public void regist(Member member, String secretCode, String code) throws OverflowException {
if (null == member || 0 >= member.getId()) {
throw new SignInIdNotExistException("Not Null Member ID");
throw new OverflowException("SignInIdNotExistException", new Throwable());
}
if (!this.checkCode(secretCode, code) ) {
throw new TotpCodeNotMatchException("Not Equal");
throw new OverflowException("TotpCodeNotMatchException",new Throwable());
}
MemberTotp totp = new MemberTotp();
@ -44,10 +44,10 @@ public class CentralMemberTotpService implements MemberTotpService {
public MemberTotp modify(MemberTotp totp) throws OverflowException {
if ( null == totp.getSecretCode() || totp.getSecretCode().equals("")) {
throw new SecretCodeNotExistException("No secret code exists");
throw new OverflowException("SecretCodeNotExistException",new Throwable());
}
if (null == totp.getMember() || 0 < totp.getMember().getId()) {
throw new SignInIdNotExistException("There is no member ID in the TOTP table.");
throw new OverflowException("SignInIdNotExistException", new Throwable());
}
return this.totpDAO.save(totp);
@ -57,14 +57,14 @@ public class CentralMemberTotpService implements MemberTotpService {
this.totpDAO.delete(id);
}
public MemberTotp read(long id) throws Exception {
public MemberTotp read(long id) throws OverflowException {
return this.totpDAO.findOne(id);
}
public boolean checkCodeForMember(Member member, String code) throws OverflowException {
MemberTotp totp = this.totpDAO.findByMember(member);
if (null == totp && (totp.getSecretCode() == null || totp.getSecretCode().equals("")) ) {
throw new SignInIdNotExistException("Error TotpMember");
throw new OverflowException("SignInIdNotExistException", new Throwable());
}
return this.checkCode(totp.getSecretCode(), code);
}
@ -75,7 +75,7 @@ public class CentralMemberTotpService implements MemberTotpService {
boolean isCheck = googleAuthenticator.authorize(secretCode, codeInt);
if (!isCheck) {
throw new TotpCodeNotMatchException("Invalid Code");
throw new OverflowException("TotpCodeNotMatchException", new Throwable());
}
return isCheck;