add 企业端 用token修改密码
This commit is contained in:
+8
@@ -285,4 +285,12 @@ public class CompanyLoginController {
|
|||||||
return Result.OK("修改密码成功");
|
return Result.OK("修改密码成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "用token修改密码")
|
||||||
|
@PostMapping(value = "/changePasswordWithToken")
|
||||||
|
public Result<?> changePasswordWithToken(@RequestBody CompanyLoginVO companyLoginVO) {
|
||||||
|
payContactsManagementService.changePasswordWithToken(companyLoginVO);
|
||||||
|
|
||||||
|
return Result.OK("修改密码成功");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -52,4 +52,6 @@ public interface IPayContactsManagementService extends IService<PayContactsManag
|
|||||||
void verificationChangePassword(CompanyLoginVO companyLoginVO);
|
void verificationChangePassword(CompanyLoginVO companyLoginVO);
|
||||||
|
|
||||||
void changePassword(CompanyLoginVO companyLoginVO);
|
void changePassword(CompanyLoginVO companyLoginVO);
|
||||||
|
|
||||||
|
void changePasswordWithToken(CompanyLoginVO companyLoginVO);
|
||||||
}
|
}
|
||||||
|
|||||||
+16
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.common.exception.JeroBootException;
|
import com.jero.common.exception.JeroBootException;
|
||||||
|
import com.jero.common.system.api.ISysBaseAPI;
|
||||||
|
import com.jero.common.system.util.JwtUtil;
|
||||||
import com.jero.common.system.vo.LoginUser;
|
import com.jero.common.system.vo.LoginUser;
|
||||||
import com.jero.common.util.*;
|
import com.jero.common.util.*;
|
||||||
import com.jero.company.entity.PayContactsManagement;
|
import com.jero.company.entity.PayContactsManagement;
|
||||||
@@ -39,6 +41,8 @@ public class PayContactsManagementServiceImpl extends ServiceImpl<PayContactsMan
|
|||||||
PayContactsManagementMapper payContactsManagementMapper;
|
PayContactsManagementMapper payContactsManagementMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
|
@Autowired
|
||||||
|
private ISysBaseAPI sysBaseAPI;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<PayContactsManagement> queryPageList(Page<PayContactsManagement> page, PayContactsManagement payContactsManagement) {
|
public IPage<PayContactsManagement> queryPageList(Page<PayContactsManagement> page, PayContactsManagement payContactsManagement) {
|
||||||
@@ -116,6 +120,10 @@ public class PayContactsManagementServiceImpl extends ServiceImpl<PayContactsMan
|
|||||||
@Override
|
@Override
|
||||||
public void changePassword(CompanyLoginVO companyLoginVO) {
|
public void changePassword(CompanyLoginVO companyLoginVO) {
|
||||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
updatePassword(companyLoginVO, loginUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updatePassword(CompanyLoginVO companyLoginVO, LoginUser loginUser) {
|
||||||
String newPassword = companyLoginVO.getNewPassword();
|
String newPassword = companyLoginVO.getNewPassword();
|
||||||
String verifyPassword = companyLoginVO.getVerifyPassword();
|
String verifyPassword = companyLoginVO.getVerifyPassword();
|
||||||
String RSAPublicKey = companyLoginVO.getRsaPublicKey();
|
String RSAPublicKey = companyLoginVO.getRsaPublicKey();
|
||||||
@@ -140,4 +148,12 @@ public class PayContactsManagementServiceImpl extends ServiceImpl<PayContactsMan
|
|||||||
String password = PasswordUtil.encrypt(PasswordUtil.decrypt(phone), newPassword, contactsManagement.getSalt());
|
String password = PasswordUtil.encrypt(PasswordUtil.decrypt(phone), newPassword, contactsManagement.getSalt());
|
||||||
this.update(new PayContactsManagement().setPassword(password), new LambdaQueryWrapper<PayContactsManagement>().eq(PayContactsManagement::getPhone, phone));
|
this.update(new PayContactsManagement().setPassword(password), new LambdaQueryWrapper<PayContactsManagement>().eq(PayContactsManagement::getPhone, phone));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changePasswordWithToken(CompanyLoginVO companyLoginVO) {
|
||||||
|
String token = companyLoginVO.getPassword();
|
||||||
|
String username = JwtUtil.getUsername(token);
|
||||||
|
LoginUser loginUser = sysBaseAPI.getUserByName(username);
|
||||||
|
updatePassword(companyLoginVO, loginUser);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user