手机号授权:重置密码操作区分主客态

This commit is contained in:
lzm
2022-12-01 18:02:04 +08:00
committed by yeungchihang
parent 65c65caad8
commit 0d59831487
2 changed files with 5 additions and 9 deletions

View File

@@ -420,7 +420,7 @@ public class AccountManageService {
/**
* 重置密码
*
* 两个场景调用 => 客户端未登录 忘记密码, 此时uid 为 null 登录状态下忘记密码 uid有值
* @param uid
* @param phone
* @param password
@@ -428,15 +428,8 @@ public class AccountManageService {
* @return 1:成功 2重置码无效 3用户不存在
*/
public OAuthStatus resetPasswordByResetCode(Long uid, String phone, String password, String resetCode) throws Exception {
Account accountUser = accountService.getById(uid);
if (accountUser == null) {
return OAuthStatus.USER_NOT_EXISTED;
}
if (!CommonUtil.checkPhoneFormat(accountUser.getPhoneAreaCode(),accountUser.getPhone())) {
return OAuthStatus.ACCOUNT_NOT_BIND_PHONE;
}
Account account = accountService.getAccountByPhone(phone);
if (null == account || !account.getUid().equals(uid)) {
if (null == account || (uid != null && !account.getUid().equals(uid)) ) {
return OAuthStatus.PHONE_BIND_ERROR;
}
//检验验证码

View File

@@ -298,6 +298,9 @@ public class AccountController extends BaseController {
return new ServiceRes(OAuthStatus.USER_NOT_EXISTED);
}
phone = account.getPhone();
if (!CommonUtil.checkPhoneFormat(account.getPhoneAreaCode(),account.getPhone())) {
return OAuthStatus.ACCOUNT_NOT_BIND_PHONE;
}
}
int count = accountService.countByPhone(phone);
if(count > 1) {