- SecurityHeaders 中间件生成随机 nonce,注入 context - BuildPageData/BuildAdminPageData 将 CSPNonce 传递给模板 - 所有 19 个模板文件 <script> 标签添加 nonce 属性 - 移除所有内联事件处理(onclick/onerror),改用事件监听 - 移除所有 javascript:void(0) 链接,改用 # 号 + preventDefault - utils.js 添加全局 avatar 图片加载失败回退处理 - common.js 登出按钮添加 preventDefault - audit.js 关闭弹窗按钮改用事件监听
61 lines
2.2 KiB
HTML
61 lines
2.2 KiB
HTML
{{template "admin/layout/base.html" .}}
|
|
<div class="page-header">
|
|
<h1>用户管理</h1>
|
|
<p class="page-desc">搜索、查看和管理本站用户</p>
|
|
</div>
|
|
|
|
<!-- 搜索与筛选 -->
|
|
<div class="filter-bar">
|
|
<input type="text" id="searchInput" class="filter-input" placeholder="搜索邮箱或用户名..." autocomplete="off">
|
|
<select id="roleFilter" class="filter-select">
|
|
<option value="">全部角色</option>
|
|
{{range $val, $label := .RoleNames}}
|
|
<option value="{{$val}}">{{$label}}</option>
|
|
{{end}}
|
|
</select>
|
|
<select id="statusFilter" class="filter-select">
|
|
<option value="">全部状态</option>
|
|
{{range $val, $label := .StatusNames}}
|
|
<option value="{{$val}}">{{$label}}</option>
|
|
{{end}}
|
|
</select>
|
|
<button id="searchBtn" class="btn btn-primary">搜索</button>
|
|
</div>
|
|
|
|
<!-- 用户表格 -->
|
|
<div class="table-container">
|
|
<table class="data-table">
|
|
<thead>
|
|
<tr>
|
|
<th>UID</th>
|
|
<th>用户名</th>
|
|
<th>邮箱</th>
|
|
<th>角色</th>
|
|
<th>状态</th>
|
|
<th>注册时间</th>
|
|
<th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="userTableBody">
|
|
<tr class="table-loading"><td colspan="7">加载中...</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- 分页 -->
|
|
<div class="pagination-bar" id="paginationBar"></div>
|
|
<script nonce="{{.CSPNonce}}">
|
|
window.__currentUid = {{.UID}};
|
|
window.__isOwner = {{if .IsOwner}}true{{else}}false{{end}};
|
|
// 由服务端 model.RoleDisplayNames / StatusDisplayNames 作为唯一数据源注入
|
|
window.__ROLE_NAMES = {
|
|
{{range $val, $label := .RoleNames}}"{{$val}}": "{{$label}}",
|
|
{{end}}
|
|
};
|
|
window.__STATUS_NAMES = {
|
|
{{range $val, $label := .StatusNames}}"{{$val}}": "{{$label}}",
|
|
{{end}}
|
|
};
|
|
</script>
|
|
{{template "admin/layout/footer.html" .}}
|