|
@@ -100,7 +100,7 @@ public class SysProfileController extends BaseController
|
|
String oldPassword = params.get("oldPassword");
|
|
String oldPassword = params.get("oldPassword");
|
|
String newPassword = params.get("newPassword");
|
|
String newPassword = params.get("newPassword");
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
- String userName = loginUser.getUsername();
|
|
|
|
|
|
+ Long userId = loginUser.getUserid();
|
|
String password = loginUser.getSysUser().getPassword();
|
|
String password = loginUser.getSysUser().getPassword();
|
|
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
|
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
|
{
|
|
{
|
|
@@ -111,7 +111,7 @@ public class SysProfileController extends BaseController
|
|
return error("新密码不能与旧密码相同");
|
|
return error("新密码不能与旧密码相同");
|
|
}
|
|
}
|
|
newPassword = SecurityUtils.encryptPassword(newPassword);
|
|
newPassword = SecurityUtils.encryptPassword(newPassword);
|
|
- if (userService.resetUserPwd(userName, newPassword) > 0)
|
|
|
|
|
|
+ if (userService.resetUserPwd(userId, newPassword) > 0)
|
|
{
|
|
{
|
|
// 更新缓存用户密码&密码最后更新时间
|
|
// 更新缓存用户密码&密码最后更新时间
|
|
loginUser.getSysUser().setPwdUpdateDate(DateUtils.getNowDate());
|
|
loginUser.getSysUser().setPwdUpdateDate(DateUtils.getNowDate());
|
|
@@ -143,8 +143,13 @@ public class SysProfileController extends BaseController
|
|
return error("文件服务异常,请联系管理员");
|
|
return error("文件服务异常,请联系管理员");
|
|
}
|
|
}
|
|
String url = fileResult.getData().getUrl();
|
|
String url = fileResult.getData().getUrl();
|
|
- if (userService.updateUserAvatar(loginUser.getUsername(), url))
|
|
|
|
|
|
+ if (userService.updateUserAvatar(loginUser.getUserid(), url))
|
|
{
|
|
{
|
|
|
|
+ String oldAvatarUrl = loginUser.getSysUser().getAvatar();
|
|
|
|
+ if (StringUtils.isNotEmpty(oldAvatarUrl))
|
|
|
|
+ {
|
|
|
|
+ remoteFileService.delete(oldAvatarUrl);
|
|
|
|
+ }
|
|
AjaxResult ajax = AjaxResult.success();
|
|
AjaxResult ajax = AjaxResult.success();
|
|
ajax.put("imgUrl", url);
|
|
ajax.put("imgUrl", url);
|
|
// 更新缓存用户头像
|
|
// 更新缓存用户头像
|