Explorar o código

实现密码栏显示、隐藏开关

James Iter %!s(int64=9) %!d(string=hai) anos
pai
achega
e65e9d74d5
Modificáronse 2 ficheiros con 20 adicións e 4 borrados
  1. 3 2
      docs/todo.md
  2. 17 2
      templates/guests_show.html

+ 3 - 2
docs/todo.md

@@ -15,7 +15,7 @@
 - [ ] 增加模板镜像上传功能
 - [x] 虚拟机加入用户级的重启作业功能
 - [x] 提示待做的启动作业
-- [ ] 密码栏默认隐藏,加入显示开关
+- [x] 密码栏默认隐藏,加入显示开关
 - [ ] 加入 tag 功能
 - [x] `不予支持`收集存在于 JimV-N,却不存在于 JimV-C 的 Guest。(无法确定其创建的规范,比如是否使用了规划的分布式文件系统、模板、开启vnc等。这样导致迁移、重置密码、前端ICON显示有问题)
 - [x] `不予支持`IP 为空的,允许用户手动补入 Guest 的真实 IP,补入时并检查新 IP 是否可用
@@ -41,5 +41,6 @@
 - [ ] 初始化页面检测redis、mysql是否准备好
 - [ ] 允许删除创建失败的虚拟机
 - [ ] 日志里面加入操作轨迹
-- [ ] 重置密码功能
+- [x] 修改密码功能
+- [ ] 密码[找回|重置]功能
 - [ ] 前端页面校验字段有效值

+ 17 - 2
templates/guests_show.html

@@ -586,6 +586,21 @@
         }
         $('#add_boot_job_modal').modal('hide');
     }
+
+    var show_real_password = false;
+    function change_display_password(me) {
+        if (show_real_password) {
+            show_real_password = false;
+            $(me).removeClass("icon-elusive-eye").addClass("icon-elusive-eye-off");
+            $('.real_password').toggle();
+            $('.unreal_password').toggle();
+        } else {
+            show_real_password = true;
+            $(me).removeClass("icon-elusive-eye-off").addClass("icon-elusive-eye");
+            $('.unreal_password').toggle();
+            $('.real_password').toggle();
+        }
+    }
 </script>
 <div class="panel">
     <div class="panel-body">
@@ -617,7 +632,7 @@
                     <th>计算节点</th>
                     <th>配置</th>
                     <th>IP</th>
-                    <th>密码</th>
+                    <th width="150px;">密码&nbsp;&nbsp;<a href="#" class="glyph-icon icon-elusive-eye-off" onclick="change_display_password(this);" style="color: #014c8c;"></a></th>
                     <th>创建时间</th>
                     <th>操作</th>
                 </tr>
@@ -643,7 +658,7 @@
                     <td>{{ item.on_host }}</td>
                     <td>CPU :&nbsp;&nbsp;{{ item.cpu }}&nbsp;核<br />内存 :&nbsp;&nbsp;{{ item.memory }}&nbsp;GB</td>
                     <td>{{ item.ip }}</td>
-                    <td>{{ item.password }}</td>
+                    <td><span class="unreal_password">******</span><span class="real_password" style="display: none;">{{ item.password }}</span></td>
                     <td>{{ format_datetime_by_tus(item.create_time) }}</td>
                     <td>
                         <div class="dropdown inline-block">