Merge branch 'develop' of https://gitee.com/likeshop_gitee/likeadmin-java into develop
This commit is contained in:
commit
32963b1ab0
|
|
@ -73,13 +73,12 @@ public class UserController {
|
|||
*/
|
||||
@PostMapping("/changePwd")
|
||||
public Object changePwd(@RequestBody Map<String, String> params) {
|
||||
Assert.notNull(params.get("oldPassword"), "oldPassword参数缺失");
|
||||
Assert.notNull(params.get("password"), "password参数缺失");
|
||||
if(!Pattern.matches("^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$", params.get("password"))){
|
||||
throw new OperateException("密码必须是6-20字母+数字组合!");
|
||||
}
|
||||
Integer userId = LikeFrontThreadLocal.getUserId();
|
||||
iUserService.changePwd(params.get("password"), params.get("oldPassword"), userId);
|
||||
iUserService.changePwd(params.get("password"), params.getOrDefault("oldPassword", null), userId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@ public class UserServiceImpl implements IUserService {
|
|||
Assert.notNull(user, "用户不存在");
|
||||
|
||||
if (!user.getPassword().equals("")) {
|
||||
Assert.notNull(oldPassword, "oldPassword参数缺失");
|
||||
String oldPwd = ToolsUtil.makeMd5(oldPassword.trim() + user.getSalt());
|
||||
if (!oldPwd.equals(user.getPassword())) {
|
||||
throw new OperateException("原密码不正确!");
|
||||
|
|
|
|||
Loading…
Reference in New Issue