BUGFIX:忘记密码;
This commit is contained in:
@@ -14,6 +14,7 @@ public class AccountRegisterDTO {
|
|||||||
@ApiModelProperty("邮箱")
|
@ApiModelProperty("邮箱")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
private Boolean verifyEmail;
|
||||||
// @NotBlank(message = "password.cannot.be.empty")
|
// @NotBlank(message = "password.cannot.be.empty")
|
||||||
@ApiModelProperty("密码")
|
@ApiModelProperty("密码")
|
||||||
private String password;
|
private String password;
|
||||||
|
|||||||
@@ -254,16 +254,19 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Boolean forgetPwd(AccountRegisterDTO accountDTO) {
|
public Boolean forgetPwd(AccountRegisterDTO accountDTO) {
|
||||||
Account emailAccount = getOneByEmail(accountDTO.getEmail());
|
// Account emailAccount = getOneByEmail(accountDTO.getEmail());
|
||||||
//校验邮箱验证码
|
//校验邮箱验证码
|
||||||
String verifyCode = LocalCacheUtils.getVerifyCodeCache(AuthenticationOperationTypeEnum.FORGET_PWD.name() + "_" + accountDTO.getEmail());
|
if (accountDTO.getVerifyEmail()) {
|
||||||
if (StringUtils.isBlank(verifyCode)) {
|
String verifyCode = LocalCacheUtils.getVerifyCodeCache(AuthenticationOperationTypeEnum.FORGET_PWD.name() + "_" + accountDTO.getEmail());
|
||||||
throw new BusinessException("the.verification.code.has.expired", ResultEnum.PROMPT.getCode());
|
if (StringUtils.isBlank(verifyCode)) {
|
||||||
|
throw new BusinessException("the.verification.code.has.expired", ResultEnum.PROMPT.getCode());
|
||||||
|
}
|
||||||
|
if (!verifyCode.equals(accountDTO.getEmailVerifyCode())) {
|
||||||
|
throw new BusinessException("verification.code.error", ResultEnum.PROMPT.getCode());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
updatePwdByEmail(accountDTO.getPassword(), accountDTO.getEmail());
|
||||||
}
|
}
|
||||||
if (!verifyCode.equals(accountDTO.getEmailVerifyCode())) {
|
|
||||||
throw new BusinessException("verification.code.error", ResultEnum.PROMPT.getCode());
|
|
||||||
}
|
|
||||||
updatePwdByEmail(accountDTO.getPassword(), accountDTO.getEmail());
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user