增加修改个人信息和修改密码菜单。

This commit is contained in:
2026-08-25 23:54:42 +08:00
parent 16ba817ecf
commit 20395a79a2
5 changed files with 189 additions and 12 deletions
+61 -1
View File
@@ -10,7 +10,13 @@
<body>
<div class="admin-header">
<h2>GoBlog</h2>
<span id="username">{{.DisplayName}}</span>
<div class="user-menu-wrapper">
<span id="username" tabindex="0" aria-haspopup="true">{{.DisplayName}}</span>
<div class="user-menu" role="menu">
<button type="button" onclick="showProfileModal()">修改个人信息</button>
<button type="button" onclick="showPasswordModal()">修改密码</button>
</div>
</div>
<span id="logout-btn">退出</span>
</div>
@@ -48,6 +54,8 @@
{{if or (index .PageSet "categories") (index .PageSet "tags") (index .PageSet "pages")}}{{template "admin_modal_common" .}}{{end}}
{{if index .PageSet "users"}}{{template "admin_modal_user" .}}{{end}}
{{if index .PageSet "themes"}}{{template "admin_modal_theme" .}}{{end}}
{{template "admin_modal_profile" .}}
{{template "admin_modal_password" .}}
<script>window.__currentUser = {{.CurrentUser }}</script>
<script src="/static/js/admin.js?v=21"></script>
@@ -55,6 +63,58 @@
</html>
{{end}}
{{define "admin_modal_profile"}}
<div id="profile-modal" class="modal hidden">
<div class="modal-content">
<h3>修改个人信息</h3>
<form id="profile-form">
<div class="form-group">
<label for="profile-nickname">昵称</label>
<input type="text" id="profile-nickname" maxlength="100">
</div>
<div class="form-group">
<label for="profile-email">邮箱</label>
<input type="email" id="profile-email" maxlength="100" required>
</div>
<div class="form-group">
<label for="profile-avatar">头像地址</label>
<input type="url" id="profile-avatar" maxlength="255" placeholder="https://">
</div>
<div class="modal-actions">
<button type="button" class="btn-secondary" onclick="hideProfileModal()">取消</button>
<button type="submit" class="btn-primary">保存</button>
</div>
</form>
</div>
</div>
{{end}}
{{define "admin_modal_password"}}
<div id="password-modal" class="modal hidden">
<div class="modal-content">
<h3>修改密码</h3>
<form id="password-form">
<div class="form-group">
<label for="old-password">旧密码</label>
<input type="password" id="old-password" required autocomplete="current-password">
</div>
<div class="form-group">
<label for="new-password">新密码</label>
<input type="password" id="new-password" required minlength="6" autocomplete="new-password">
</div>
<div class="form-group">
<label for="confirm-password">确认新密码</label>
<input type="password" id="confirm-password" required minlength="6" autocomplete="new-password">
</div>
<div class="modal-actions">
<button type="button" class="btn-secondary" onclick="hidePasswordModal()">取消</button>
<button type="submit" class="btn-primary">保存</button>
</div>
</form>
</div>
</div>
{{end}}
{{define "admin_page_dashboard"}}
<!-- 仪表盘 -->
<div id="dashboard-page" class="page">