From 9d6c8bcd9af74365858b105fafbd45c7efe39b30 Mon Sep 17 00:00:00 2001
From: zhangjian <zhangjianrock@163.com>
Date: Sat, 07 Oct 2023 10:22:40 +0800
Subject: [PATCH] 修改端口为6100
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
index cc2573e..80e6733 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -6,6 +6,7 @@
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
+import com.ruoyi.utils.result.Results;
import io.swagger.annotations.*;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -237,4 +238,25 @@
public AjaxResult deptTree(SysDept dept) {
return success(deptService.selectDeptTreeList(dept));
}
+
+ /**
+ * 修改密码
+ */
+ @ApiOperation("修改密码")
+// @PreAuthorize("@ss.hasPermi('system:user:changePwd')")
+ @PutMapping("/changePwd")
+ public Results changePwd(String newPassword) {
+ String userId = SecurityUtils.getUserId();
+ SysUser sysUser = userService.selectUserById(userId);
+ userService.checkUserAllowed(sysUser);
+ userService.checkUserDataScope(userId);
+ sysUser.setPassword(SecurityUtils.encryptPassword(newPassword));
+ sysUser.setUpdateBy(getUsername());
+ int num = userService.resetPwd(sysUser);
+ if(num == 0){
+ return Results.error("修改密码失败!");
+ }else {
+ return Results.succeed("修改密码成功!");
+ }
+ }
}
--
Gitblit v1.9.3