fix: 修复个人设置中修改密码失败的问题
This commit is contained in:
parent
81d64b5932
commit
794af4605e
|
@ -487,20 +487,18 @@ public class UserService {
|
||||||
|
|
||||||
/*修改当前用户用户密码*/
|
/*修改当前用户用户密码*/
|
||||||
private User updateCurrentUserPwd(EditPassWordRequest request) {
|
private User updateCurrentUserPwd(EditPassWordRequest request) {
|
||||||
if (SessionUtils.getUser() != null) {
|
String oldPassword = CodingUtil.md5(request.getPassword(), "utf-8");
|
||||||
User user = userMapper.selectByPrimaryKey(SessionUtils.getUser().getId());
|
String newPassword = request.getNewpassword();
|
||||||
String pwd = user.getPassword();
|
UserExample userExample = new UserExample();
|
||||||
String prepwd = CodingUtil.md5(request.getPassword(), "utf-8");
|
userExample.createCriteria().andIdEqualTo(SessionUtils.getUser().getId()).andPasswordEqualTo(oldPassword);
|
||||||
String newped = request.getNewpassword();
|
List<User> users = userMapper.selectByExample(userExample);
|
||||||
if (StringUtils.isNotBlank(prepwd)) {
|
if (!CollectionUtils.isEmpty(users)) {
|
||||||
if (prepwd.trim().equals(pwd.trim())) {
|
User user = users.get(0);
|
||||||
user.setPassword(CodingUtil.md5(newped));
|
user.setPassword(CodingUtil.md5(newPassword));
|
||||||
user.setUpdateTime(System.currentTimeMillis());
|
user.setUpdateTime(System.currentTimeMillis());
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
MSException.throwException(Translator.get("password_modification_failed"));
|
MSException.throwException(Translator.get("password_modification_failed"));
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,8 +510,8 @@ public class UserService {
|
||||||
/*管理员修改用户密码*/
|
/*管理员修改用户密码*/
|
||||||
private User updateUserPwd(EditPassWordRequest request) {
|
private User updateUserPwd(EditPassWordRequest request) {
|
||||||
User user = userMapper.selectByPrimaryKey(request.getId());
|
User user = userMapper.selectByPrimaryKey(request.getId());
|
||||||
String newped = request.getNewpassword();
|
String newPassword = request.getNewpassword();
|
||||||
user.setPassword(CodingUtil.md5(newped));
|
user.setPassword(CodingUtil.md5(newPassword));
|
||||||
user.setUpdateTime(System.currentTimeMillis());
|
user.setUpdateTime(System.currentTimeMillis());
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue