Browse Source

增加密码重置、解锁需要二次鉴别

xusl 1 năm trước cách đây
mục cha
commit
7c8318d079

+ 3 - 1
backend/src/main/java/com/jiayue/ssi/controller/SysUserController.java

@@ -388,6 +388,7 @@ public class SysUserController {
      * 初始密码发送邮箱
      */
     @PostMapping(value = "/resetPassword")
+    @AgainVerify
     @OperateLog(title = "用户管理", businessType = BusinessType.RESETPWD, auditType = AuditType.SYS,operdesc = "初始/重置密码发送邮箱")
     @PreAuthorize("@ss.hasPermi('system:user:send')")
     @PreventReplay
@@ -574,6 +575,7 @@ public class SysUserController {
      * 解锁用户信息
      */
     @PostMapping(value = "/relockUser")
+    @AgainVerify
     @OperateLog(title = "用户管理", businessType = BusinessType.UNLOCK, auditType = AuditType.SYS,operdesc = "用户账号解锁")
     @PreAuthorize("@ss.hasPermi('system:user:relock')")
     @PreventReplay
@@ -833,7 +835,7 @@ public class SysUserController {
             activeUserDto.setAuthentication(authentication);
             activeUserDto.setHttpServletRequest(request);
             CacheConstants.ACTIVE_USER_MAP.put(sysUser.getUsername(),activeUserDto);
-            LocalCache.set(CacheConstants.HEART_KEY+sysUser.getUsername(),"在线",5000);
+            LocalCache.set(CacheConstants.HEART_KEY+sysUser.getUsername(),"在线",8000);
             System.out.println("存心跳:"+DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
             return ResponseVO.success();
         } catch (Exception e) {

+ 3 - 0
ui/src/views/login/index.vue

@@ -413,6 +413,9 @@ export default {
   }
 }
 
+</style>
+
+<style rel="stylesheet/scss" lang="scss" scoped>
 .no-autofill-pwd{
   text-security:disc!important;
   -webkit-text-security:disc!important;

+ 40 - 23
ui/src/views/sysManager/userManager/index.vue

@@ -739,10 +739,18 @@ export default {
         });
         return
       }
-      this.$confirm('创建密码并发送到邮箱:' + row.mailbox, '提示', {
+
+      this.$prompt('请输入登录密码', '鉴别操作', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
-        type: 'warning',
+        inputType: 'text',
+        customClass:'no-autofill-pwd',
+        inputValidator: (val) => {
+          if (val === null || val.length < 1 || val.length > 20) {
+            return false;
+          }
+        },
+        inputErrorMessage: '不能为空,最多可录入20个字符',
         beforeClose(action, instance, done) {
           if (action === "confirm") {
             instance.$refs["confirm"].$el.onclick = (function (e) {
@@ -755,13 +763,12 @@ export default {
             done();
           }
         }
-      }).then(() => {
-        this.doResetPwd(row)
-      }).catch(() => {
-        //取消操作
-      });
+      }).then(async ({value}) => {
+        this.doResetPwd(row, value)
+      }).catch((e) => {
+      })
     },
-    doResetPwd: debounce(async function (row) {
+    doResetPwd: debounce(async function (row,againPwd) {
       let sysTime
       let lk
       await this.$axios.get('/sysPolicyController/getLicenseKey').then((res) => {
@@ -772,6 +779,7 @@ export default {
 
       const param = {
         id: row.id,
+        againPwd: againPwd,
         sysTime: sysTime,
         lk: lk
       }
@@ -956,10 +964,18 @@ export default {
         });
         return
       }
-      this.$confirm('是否解锁用户?', '提示', {
+
+      this.$prompt('请输入登录密码', '鉴别操作', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
-        type: 'warning',
+        inputType: 'text',
+        customClass:'no-autofill-pwd',
+        inputValidator: (val) => {
+          if (val === null || val.length < 1 || val.length > 20) {
+            return false;
+          }
+        },
+        inputErrorMessage: '不能为空,最多可录入20个字符',
         beforeClose(action, instance, done) {
           if (action === "confirm") {
             instance.$refs["confirm"].$el.onclick = (function (e) {
@@ -972,16 +988,17 @@ export default {
             done();
           }
         }
-      }).then(() => {
-        this.doRelock(_selectData)
-      }).catch(() => {
-        //取消操作
-      });
+      }).then(async ({value}) => {
+        this.doRelock(_selectData, value)
+      }).catch((e) => {
+      })
+
+
     },
     /**
      * 解锁提交
      */
-    doRelock: debounce(async function (_selectData) {
+    doRelock: debounce(async function (_selectData, againPwd) {
       let sysTime
       let lk
       await this.$axios.get('/sysPolicyController/getLicenseKey').then((res) => {
@@ -991,6 +1008,7 @@ export default {
       })
       const param = {
         id: _selectData.id,
+        againPwd: againPwd,
         sysTime: sysTime,
         lk: lk
       }
@@ -1233,14 +1251,13 @@ export default {
   }
 };
 </script>
-
 <style rel="stylesheet/scss" lang="scss">
-  .no-autofill-pwd{
-    .el-message-box__content{
-      .el-input__inner{
-        text-security:disc!important;
-        -webkit-text-security:disc!important;
-      }
+.no-autofill-pwd{
+  .el-message-box__content{
+    .el-input__inner{
+      text-security:disc!important;
+      -webkit-text-security:disc!important;
     }
   }
+}
 </style>

+ 1 - 1
ui/src/views/sysManager/userManager/profile/resetPwd.vue

@@ -158,7 +158,7 @@ export default {
 };
 </script>
 
-<style rel="stylesheet/scss" lang="scss">
+<style rel="stylesheet/scss" lang="scss" scoped>
 .no-autofill-pwd{
   text-security:disc!important;
   -webkit-text-security:disc!important;