手机号授权: 重置密码返回状态调整、后台短信参数调整
This commit is contained in:
@@ -22,10 +22,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class PhoneAuthApplyRecordAdiminService extends BaseService {
|
||||
@@ -95,7 +92,7 @@ public class PhoneAuthApplyRecordAdiminService extends BaseService {
|
||||
throw new ServiceException(BusiStatus.SERVER_BUSY);
|
||||
}
|
||||
try {
|
||||
if (applyRecord.getStatus() != Constant.PhoneAuthApplyStatus.wait_audit) {
|
||||
if (!Objects.equals(applyRecord.getStatus(), Constant.PhoneAuthApplyStatus.wait_audit)) {
|
||||
throw new ServiceException("该记录已审核!请刷新后重试");
|
||||
}
|
||||
|
||||
@@ -125,14 +122,14 @@ public class PhoneAuthApplyRecordAdiminService extends BaseService {
|
||||
String realPhone = phoneAreaCode + phone;
|
||||
// 短信内容显示的手机号
|
||||
String msgPhone = "+" + phoneAreaCode + " " + StringUtils.maskPhone(phoneAreaCode, realPhone);
|
||||
|
||||
if (Constant.PhoneAuthApplyStatus.pass.equals(status)) {
|
||||
templateCode = aliyunSmsConfig.getAuthSuccessTemplateCode();
|
||||
|
||||
param.put("authorization", record.getAuthCode());
|
||||
}
|
||||
|
||||
if (Constant.PhoneAuthApplyStatus.fail.equals(status)) {
|
||||
}else {
|
||||
// 失败
|
||||
templateCode = aliyunSmsConfig.getAuthFailTemplateCode();
|
||||
param.put("number", msgPhone);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(templateCode)) {
|
||||
@@ -140,7 +137,6 @@ public class PhoneAuthApplyRecordAdiminService extends BaseService {
|
||||
|
||||
AliyunSmsRet aliyunSmsRet = null;
|
||||
try {
|
||||
param.put("number", msgPhone);
|
||||
aliyunSmsRet = aliyunSmsService.sendSms(realPhone, templateCode, aliyunSmsConfig.getSignName(), param);
|
||||
logger.info("sendSmsCode to {},code ={}, response msg:{}", realPhone, templateCode, gson.toJson(aliyunSmsRet));
|
||||
} catch (ClientException e) {
|
||||
|
@@ -421,14 +421,15 @@ public class AccountManageService {
|
||||
/**
|
||||
* 重置密码
|
||||
*
|
||||
* @param uid
|
||||
* @param phone
|
||||
* @param password
|
||||
* @param resetCode
|
||||
* @return 1:成功 2:重置码无效 3:用户不存在
|
||||
*/
|
||||
public OAuthStatus resetPasswordByResetCode(String phone, String password, String resetCode) throws Exception {
|
||||
public OAuthStatus resetPasswordByResetCode(Long uid, String phone, String password, String resetCode) throws Exception {
|
||||
Account account = accountService.getAccountByPhone(phone);
|
||||
if (null == account) {
|
||||
if (null == account || !account.getUid().equals(uid)) {
|
||||
return OAuthStatus.USER_NOT_EXISTED;
|
||||
}
|
||||
//检验验证码
|
||||
|
@@ -307,7 +307,7 @@ public class AccountController extends BaseController {
|
||||
|
||||
OAuthStatus status;
|
||||
try {
|
||||
status = accountManageService.resetPasswordByResetCode(phone, newPwd, smsCode);
|
||||
status = accountManageService.resetPasswordByResetCode(uid,phone, newPwd, smsCode);
|
||||
} catch (Exception e) {
|
||||
status = OAuthStatus.INVALID_SERVICE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user