zhangli
2026-05-09 6fb3e3602f7986ee0b9f9f96245a7b3c1d28ab11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>修改密码 - 文档管理系统</title>
  <link href="/static/css/all.min.css" rel="stylesheet">
  <style>
    * { margin: 0; padding: 0; box-sizing: border-box; }
    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      background: #f0f2f5;
      color: #1a1a2e;
      min-height: 100vh;
    }
    .header {
      background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
      color: white;
      padding: 24px 32px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 12px;
    }
    .header h1 { font-size: 22px; display: flex; align-items: center; gap: 10px; }
    .header .nav-links {
      display: flex; gap: 8px; align-items: center;
    }
    .header .nav-links a {
      color: rgba(255,255,255,0.8);
      text-decoration: none;
      font-size: 14px;
      padding: 6px 14px;
      border-radius: 8px;
      border: 1px solid rgba(255,255,255,0.2);
      transition: all 0.2s;
    }
    .header .nav-links a:hover {
      background: rgba(255,255,255,0.1);
      color: white;
    }
    .container { max-width: 520px; margin: 40px auto; padding: 0 20px; }
 
    .card {
      background: white;
      border-radius: 16px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.08);
      overflow: hidden;
    }
    .card .card-header {
      padding: 20px 24px;
      border-bottom: 1px solid #eef0f4;
    }
    .card .card-header h2 {
      font-size: 16px;
      display: flex; align-items: center; gap: 8px;
    }
    .card .card-body { padding: 24px; }
 
    .form-group { margin-bottom: 20px; }
    .form-group label {
      display: block;
      font-size: 14px;
      font-weight: 500;
      color: #374151;
      margin-bottom: 6px;
    }
    .form-group .input-wrap {
      position: relative;
    }
    .form-group .input-wrap i {
      position: absolute;
      left: 14px;
      top: 50%;
      transform: translateY(-50%);
      color: #9ca3af;
    }
    .form-group input {
      width: 100%;
      padding: 11px 14px 11px 42px;
      border: 1px solid #d1d5db;
      border-radius: 10px;
      font-size: 15px;
      outline: none;
      transition: border-color 0.2s;
    }
    .form-group input:focus {
      border-color: #2563eb;
      box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
    }
 
    .msg {
      padding: 10px 14px;
      border-radius: 8px;
      font-size: 13px;
      margin-bottom: 20px;
      display: none;
      align-items: center;
      gap: 8px;
    }
    .msg.show { display: flex; }
    .msg.success {
      background: #ecfdf5;
      border: 1px solid #6ee7b7;
      color: #059669;
    }
    .msg.error {
      background: #fef2f2;
      border: 1px solid #fca5a5;
      color: #dc2626;
    }
 
    .btn-submit {
      width: 100%;
      padding: 12px;
      background: #2563eb;
      color: white;
      border: none;
      border-radius: 10px;
      font-size: 16px;
      font-weight: 500;
      cursor: pointer;
      transition: background 0.2s;
    }
    .btn-submit:hover { background: #1d4ed8; }
  </style>
</head>
<body>
 
<div class="header">
  <h1><i class="fa-solid fa-key"></i> 修改密码</h1>
  <div class="nav-links">
    <a href="/"><i class="fa-solid fa-arrow-left"></i> 返回后台</a>
    <a href="/logout"><i class="fa-solid fa-arrow-right-from-bracket"></i> 退出</a>
  </div>
</div>
 
<div class="container">
  <div class="card">
    <div class="card-header">
      <h2><i class="fa-solid fa-lock"></i> 修改登录密码 — <span style="color:#2563eb;font-size:14px;"><%= user.username %></span></h2>
    </div>
    <div class="card-body">
      <% if (success) { %>
        <div class="msg success show">
          <i class="fa-regular fa-circle-check"></i>
          <span><%= success %></span>
        </div>
      <% } %>
      <% if (error) { %>
        <div class="msg error show">
          <i class="fa-solid fa-circle-exclamation"></i>
          <span><%= error %></span>
        </div>
      <% } %>
 
      <form method="POST" action="/api/change-password">
        <div class="form-group">
          <label>当前密码</label>
          <div class="input-wrap">
            <i class="fa-solid fa-lock"></i>
            <input type="password" name="oldPassword" placeholder="输入当前密码" required>
          </div>
        </div>
        <div class="form-group">
          <label>新密码</label>
          <div class="input-wrap">
            <i class="fa-solid fa-key"></i>
            <input type="password" name="newPassword" placeholder="至少 6 位" minlength="6" required>
          </div>
        </div>
        <div class="form-group">
          <label>确认新密码</label>
          <div class="input-wrap">
            <i class="fa-solid fa-key"></i>
            <input type="password" name="confirmPassword" placeholder="再次输入新密码" minlength="6" required>
          </div>
        </div>
        <button type="submit" class="btn-submit">
          <i class="fa-regular fa-floppy-disk"></i> 保存修改
        </button>
      </form>
    </div>
  </div>
</div>
 
</body>
</html>