邮箱-错误码

This commit is contained in:
khalil
2025-03-19 11:31:31 +08:00
parent 9d018db6e4
commit 1970fd74c6
4 changed files with 22 additions and 13 deletions

View File

@@ -402,23 +402,23 @@ public class AccountManageService {
* @return 1:成功 2重置码无效 3用户不存在
*/
public void resetPasswordByEmailCode(Long uid, String email, String password, String code) {
if (!CommonUtil.checkEmailFormat(email)){
throw new ServiceException(BusiStatus.ACCOUNT_NOT_BIND_PHONE);
}
emailService.validEmailAddress(email);
long count = accountService.countByEmail(email);
if (count > 1L) {
throw new ServiceException(BusiStatus.PHONE_BIND_TOO_MANY_ACCOUNT);
throw new ServiceException(BusiStatus.EMAIL_BIND_TOO_MANY_ACCOUNT);
}
Account account = accountService.getAccountByEmail(email);
if (null == account || (null != uid && !account.getUid().equals(uid))) {
throw new ServiceException(BusiStatus.PHONE_BIND_ERROR);
if (null == account || !StringUtils.hasText(account.getPassword())) {
throw new ServiceException(BusiStatus.ACCOUNT_NOT_BIND_EMAIL);
} else if (null != uid && !account.getUid().equals(uid)) {
throw new ServiceException(BusiStatus.ACCOUNT_BIND_EMAIL_DIFF);
}
//检验验证码
if (!emailService.verifyCodeByCache(email, code)) {
throw new ServiceException(BusiStatus.INVALID_IDENTIFYING_CODE);
throw new ServiceException(BusiStatus.INVALID_IDENTIFYING_EMAIL_CODE);
}
accountService.resetAccountPwd(account.getUid(), password);