调整配置文件。优化代码格式。
This commit is contained in:
parent
6d7517f778
commit
151a33cad4
@ -62,8 +62,3 @@ plusone:
|
|||||||
# 异常拦截机制是否拦截所有异常
|
# 异常拦截机制是否拦截所有异常
|
||||||
exception:
|
exception:
|
||||||
handle-all-exception: false
|
handle-all-exception: false
|
||||||
|
|
||||||
# 日志配置
|
|
||||||
logging:
|
|
||||||
level:
|
|
||||||
root: debug
|
|
||||||
|
@ -9,3 +9,8 @@ plusone:
|
|||||||
code: Plusone
|
code: Plusone
|
||||||
template:
|
template:
|
||||||
code: 【Plusone】验证码:%s,10分钟内有效,请勿泄露。
|
code: 【Plusone】验证码:%s,10分钟内有效,请勿泄露。
|
||||||
|
# 日志配置
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
root: info
|
||||||
|
'[xyz.zhouxy.plusone]': debug
|
||||||
|
@ -34,7 +34,7 @@ import xyz.zhouxy.plusone.validator.InvalidInputException;
|
|||||||
@Service
|
@Service
|
||||||
public class AccountContextService {
|
public class AccountContextService {
|
||||||
|
|
||||||
private final static StpLogic adminAuthLogic = AuthLogic.adminAuthLogic;
|
private static final StpLogic adminAuthLogic = AuthLogic.adminAuthLogic;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AccountQueries accountQueries;
|
private AccountQueries accountQueries;
|
||||||
@ -95,7 +95,7 @@ public class AccountContextService {
|
|||||||
case MOBILE_PHONE -> accountRepository.findByMobilePhone(MobilePhone.of(principal));
|
case MOBILE_PHONE -> accountRepository.findByMobilePhone(MobilePhone.of(principal));
|
||||||
default -> throw InvalidInputException.unsupportedPrincipalTypeException("输入邮箱地址或手机号");
|
default -> throw InvalidInputException.unsupportedPrincipalTypeException("输入邮箱地址或手机号");
|
||||||
};
|
};
|
||||||
Assert.notNull(account, () -> AccountLoginException.accountNotExistException());
|
Assert.notNull(account, AccountLoginException::accountNotExistException);
|
||||||
|
|
||||||
mailAndSmsVerifyService.checkOtp(principal, command.getOtp());
|
mailAndSmsVerifyService.checkOtp(principal, command.getOtp());
|
||||||
}
|
}
|
||||||
|
@ -49,9 +49,9 @@ public class AdminLoginService {
|
|||||||
case EMAIL -> accountRepository.findByEmail(Email.of(principal));
|
case EMAIL -> accountRepository.findByEmail(Email.of(principal));
|
||||||
case MOBILE_PHONE -> accountRepository.findByMobilePhone(MobilePhone.of(principal));
|
case MOBILE_PHONE -> accountRepository.findByMobilePhone(MobilePhone.of(principal));
|
||||||
};
|
};
|
||||||
Assert.notNull(account, () -> AccountLoginException.accountNotExistException());
|
Assert.notNull(account, AccountLoginException::accountNotExistException);
|
||||||
var isPasswordCorrect = account.checkPassword(command.getPassword());
|
var isPasswordCorrect = account.checkPassword(command.getPassword());
|
||||||
Assert.isTrue(isPasswordCorrect, () -> AccountLoginException.passwordErrorException());
|
Assert.isTrue(isPasswordCorrect, AccountLoginException::passwordErrorException);
|
||||||
|
|
||||||
adminAuthLogic.login(account.getId().orElseThrow(), command.isRememberMe());
|
adminAuthLogic.login(account.getId().orElseThrow(), command.isRememberMe());
|
||||||
var accountDetails = accountQueries.queryAccountDetails(account.getId().orElseThrow());
|
var accountDetails = accountQueries.queryAccountDetails(account.getId().orElseThrow());
|
||||||
@ -66,7 +66,7 @@ public class AdminLoginService {
|
|||||||
case MOBILE_PHONE -> accountRepository.findByMobilePhone(MobilePhone.of(principal));
|
case MOBILE_PHONE -> accountRepository.findByMobilePhone(MobilePhone.of(principal));
|
||||||
default -> throw InvalidInputException.unsupportedPrincipalTypeException("输入邮箱地址或手机号");
|
default -> throw InvalidInputException.unsupportedPrincipalTypeException("输入邮箱地址或手机号");
|
||||||
};
|
};
|
||||||
Assert.notNull(account, () -> AccountLoginException.accountNotExistException());
|
Assert.notNull(account, AccountLoginException::accountNotExistException);
|
||||||
|
|
||||||
mailAndSmsVerifyService.checkOtp(principal, command.getOtp());
|
mailAndSmsVerifyService.checkOtp(principal, command.getOtp());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user