add 用户使用短信修改密码
This commit is contained in:
+7
-8
@@ -3,7 +3,6 @@ package com.jero.company.controller;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.CacheConstant;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
@@ -199,15 +198,15 @@ public class CompanyLoginController {
|
||||
|
||||
@ApiOperation(value = "发送手机号验证码")
|
||||
@GetMapping(value = "/sendVerificationCode")
|
||||
public Result<?> sendVerificationCode(String mobile) {
|
||||
mobile = PasswordUtil.encrypt(mobile);
|
||||
public Result<?> sendVerificationCode(String phone) {
|
||||
phone = PasswordUtil.encrypt(phone);
|
||||
LambdaQueryWrapper<PayContactsManagement> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PayContactsManagement::getPhone, mobile);
|
||||
queryWrapper.eq(PayContactsManagement::getPhone, phone);
|
||||
PayContactsManagement contactsManagement = payContactsManagementService.getOne(queryWrapper);
|
||||
if (Objects.isNull(contactsManagement)){
|
||||
throw new JeroBootException("手机号不是企业联系人");
|
||||
}
|
||||
sysBaseAPI.sendVerificationCode(mobile,"2",null,null);
|
||||
sysBaseAPI.sendVerificationCode(phone,"2",null,null);
|
||||
if (StringUtils.isBlank(contactsManagement.getPassword())){
|
||||
return Result.error("updatePassword");
|
||||
}
|
||||
@@ -215,9 +214,9 @@ public class CompanyLoginController {
|
||||
}
|
||||
|
||||
@ApiOperation(value = "短信验证码修改密码")
|
||||
@PostMapping(value = "/changePassword")
|
||||
public Result<?> changePassword(@RequestBody CompanyLoginVO companyLoginVO) {
|
||||
payContactsManagementService.changePassword(companyLoginVO);
|
||||
@PostMapping(value = "/verificationChangePassword")
|
||||
public Result<?> verificationChangePassword(@RequestBody CompanyLoginVO companyLoginVO) {
|
||||
payContactsManagementService.verificationChangePassword(companyLoginVO);
|
||||
return Result.OK("修改密码成功");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -49,5 +49,5 @@ public interface IPayContactsManagementService extends IService<PayContactsManag
|
||||
*/
|
||||
List<PayContactsManagement> listPayContactsManagement(List<String> phoneList);
|
||||
|
||||
void changePassword(CompanyLoginVO companyLoginVO);
|
||||
void verificationChangePassword(CompanyLoginVO companyLoginVO);
|
||||
}
|
||||
|
||||
+2
-3
@@ -14,7 +14,6 @@ import com.jero.company.entity.PayContactsManagement;
|
||||
import com.jero.company.mapper.PayContactsManagementMapper;
|
||||
import com.jero.company.service.IPayContactsManagementService;
|
||||
import com.jero.company.vo.CompanyLoginVO;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -64,14 +63,14 @@ public class PayContactsManagementServiceImpl extends ServiceImpl<PayContactsMan
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changePassword(CompanyLoginVO companyLoginVO) {
|
||||
public void verificationChangePassword(CompanyLoginVO companyLoginVO) {
|
||||
ValidUtil.validate(companyLoginVO);
|
||||
|
||||
//前端传入密码解密
|
||||
String phone = companyLoginVO.getPhone();
|
||||
String password = companyLoginVO.getPassword();
|
||||
String verifyPassword = companyLoginVO.getVerifyPassword();
|
||||
String RSAPublicKey = companyLoginVO.getRsapublickey();
|
||||
String RSAPublicKey = companyLoginVO.getRsaPublicKey();
|
||||
String RSAPrivateKey = String.valueOf(redisUtil.get(RSAPublicKey));
|
||||
try {
|
||||
password = CommonUtils.decryptBtRsaPriKey(password, RSAPrivateKey);
|
||||
|
||||
@@ -47,6 +47,6 @@ public class CompanyLoginVO {
|
||||
|
||||
@ApiModelProperty(value = "RSA公钥")
|
||||
@NotEmpty(message = "RSA公钥不能为空!")
|
||||
private String rsapublickey;
|
||||
private String rsaPublicKey;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user