model change

This commit is contained in:
insanity 2018-04-24 19:30:09 +09:00
parent 2a30b37875
commit 7df5c1458a
6 changed files with 33 additions and 31 deletions

View File

@ -5,7 +5,6 @@ import com.loafle.overflow.central.commons.utils.EmailSender;
import com.loafle.overflow.central.commons.utils.SessionMetadata;
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.*;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.apikey.ApiKey;
@ -129,7 +128,7 @@ public class CentralMemberService implements MemberService {
try {
this.emailAuthService.sendEmailResetPassword(member);
} catch (MailException e) {
} catch (Exception e) {
// Todo ReSend Mail
e.printStackTrace();
}
@ -150,7 +149,7 @@ public class CentralMemberService implements MemberService {
Member member = this.memberDAO.findByEmail(deEmail);
if (null == member) {
throw new SignInIdNotExistException();
throw new OverflowException("", null);
}
boolean checkPass = this.isPasswordStrong(pw);

View File

@ -28,8 +28,8 @@ public class CentralMemberTotpService implements MemberTotpService {
throw new OverflowException("SignInIdNotExistException", new Throwable());
}
if (!this.checkCode(secretCode, code) ) {
throw new OverflowException("TotpCodeNotMatchException",new Throwable());
if (!this.checkCode(secretCode, code)) {
throw new OverflowException("TotpCodeNotMatchException", new Throwable());
}
MemberTotp totp = new MemberTotp();
@ -40,8 +40,8 @@ public class CentralMemberTotpService implements MemberTotpService {
}
public MemberTotp modify(MemberTotp totp) throws OverflowException {
if ( null == totp.getSecretCode() || totp.getSecretCode().equals("")) {
throw new OverflowException("SecretCodeNotExistException",new Throwable());
if (null == totp.getSecretCode() || totp.getSecretCode().equals("")) {
throw new OverflowException("SecretCodeNotExistException", new Throwable());
}
if (null == totp.getMember() || 0 < totp.getMember().getId()) {
throw new OverflowException("SignInIdNotExistException", new Throwable());
@ -60,7 +60,7 @@ public class CentralMemberTotpService implements MemberTotpService {
public boolean checkCodeForMember(Member member, String code) throws OverflowException {
MemberTotp totp = this.totpDAO.findByMember(member);
if (null == totp && (totp.getSecretCode() == null || totp.getSecretCode().equals("")) ) {
if (null == totp && (totp.getSecretCode() == null || totp.getSecretCode().equals(""))) {
throw new OverflowException("SignInIdNotExistException", new Throwable());
}
return this.checkCode(totp.getSecretCode(), code);
@ -85,12 +85,10 @@ public class CentralMemberTotpService implements MemberTotpService {
final GoogleAuthenticatorKey key = googleAuthenticator.createCredentials();
String secret = key.getKey();
// List<Integer> scratchCodes = key.getScratchCodes();
// String otpAuthURL = GoogleAuthenticatorQRGenerator.getOtpAuthURL("overFlow", member.getEmail(), key);
URIBuilder uri = (new URIBuilder()).setScheme("otpauth")
.setHost("totp")
.setPath("/" + formatLabel("overFlow", member.getEmail()))
.setParameter("secret", key.getKey());
// List<Integer> scratchCodes = key.getScratchCodes();
// String otpAuthURL = GoogleAuthenticatorQRGenerator.getOtpAuthURL("overFlow", member.getEmail(), key);
URIBuilder uri = (new URIBuilder()).setScheme("otpauth").setHost("totp")
.setPath("/" + formatLabel("overFlow", member.getEmail())).setParameter("secret", key.getKey());
returnMap.put("key", secret);
returnMap.put("uri", uri.toString());
@ -99,10 +97,10 @@ public class CentralMemberTotpService implements MemberTotpService {
}
private String formatLabel(String issuer, String accountName) throws OverflowException {
if(accountName != null && accountName.trim().length() != 0) {
if (accountName != null && accountName.trim().length() != 0) {
StringBuilder sb = new StringBuilder();
if(issuer != null) {
if(issuer.contains(":")) {
if (issuer != null) {
if (issuer.contains(":")) {
throw new IllegalArgumentException("Issuer cannot contain the ':' character.");
}

View File

@ -20,15 +20,12 @@ import com.loafle.overflow.service.central.domain.DomainMemberService;
import com.loafle.overflow.service.central.noauthprobe.NoAuthProbeService;
import com.loafle.overflow.service.central.probe.ProbeService;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

View File

@ -1,6 +1,12 @@
package com.loafle.overflow.central.module.target.service;
import com.loafle.overflow.central.module.infra.service.*;
import com.loafle.overflow.model.infra.InfraService;
import com.loafle.overflow.service.central.infra.InfraHostService;
import com.loafle.overflow.service.central.infra.InfraMachineService;
import com.loafle.overflow.service.central.infra.InfraOSPortService;
import com.loafle.overflow.service.central.infra.InfraOSService;
import com.loafle.overflow.service.central.infra.InfraServiceService;
import com.loafle.overflow.service.central.target.TargetService;
import org.springframework.beans.factory.annotation.Autowired;
@ -25,7 +31,7 @@ public class TargetDiscoveryService {
private InfraHostService infraHostService;
@Autowired
private com.loafle.overflow.central.module.infra.service.InfraService infraService;
private InfraService infraService;
@Autowired
private InfraOSPortService infraOSPortService;

View File

@ -1,10 +1,10 @@
package com.loafle.overflow.central.module.member.service;
import com.loafle.overflow.central.module.domain.model.Domain;
import com.loafle.overflow.central.module.member.model.Member;
import com.loafle.overflow.central.module.member.model.MemberTotp;
import com.loafle.overflow.central.module.meta.model.MetaMemberStatus;
import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.model.member.Member;
import com.loafle.overflow.service.central.member.MemberService;
import com.loafle.overflow.service.central.member.MemberTotpService;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

View File

@ -1,8 +1,10 @@
package com.loafle.overflow.central.module.member.service;
import com.loafle.overflow.central.module.member.model.Member;
import com.loafle.overflow.central.module.member.model.MemberTotp;
import com.loafle.overflow.central.spring.AppConfigTest;
import com.loafle.overflow.model.member.Member;
import com.loafle.overflow.model.member.MemberTotp;
import com.loafle.overflow.service.central.member.MemberTotpService;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;