78 lines
4.2 KiB
HTML
78 lines
4.2 KiB
HTML
{{define "header"}}<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>{{.Title}} · 采集采购管理端</title>
|
||
<link rel="stylesheet" href="/static/css/app.css">
|
||
</head>
|
||
<body>
|
||
|
||
<nav class="nav">
|
||
<span class="nav-brand">采集采购管理端</span>
|
||
<a href="/shopee" class="{{if eq .Active "shopee"}}active{{end}}">蝦皮数据</a>
|
||
<a href="/pdd" class="{{if eq .Active "pdd"}}active{{end}}">PDD 商品</a>
|
||
<a href="/syb" class="{{if eq .Active "syb"}}active{{end}}">顺运宝数据</a>
|
||
<a href="/tasks" class="{{if eq .Active "tasks"}}active{{end}}">采集采购</a>
|
||
<a href="/clients" class="{{if eq .Active "clients"}}active{{end}}">客户端列表</a>
|
||
{{if and .CurrentUser .CurrentUser.IsAdmin}}
|
||
<a href="/users" class="{{if eq .Active "users"}}active{{end}}">用户管理</a>
|
||
{{end}}
|
||
{{if .CurrentUser}}
|
||
<span class="nav-user">{{.CurrentUser.Username}}</span>
|
||
{{if .CurrentUser.IsAdmin}}
|
||
<button type="button" class="nav-account" data-modal-open="change-password-modal">修改密码</button>
|
||
{{end}}
|
||
<form class="nav-logout" method="post" action="/logout">
|
||
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
|
||
<button type="submit">退出登录</button>
|
||
</form>
|
||
{{end}}
|
||
</nav>
|
||
|
||
{{if and .CurrentUser .CurrentUser.IsAdmin}}
|
||
<div class="modal-backdrop" id="change-password-modal" {{if not .PasswordChangeOpen}}hidden{{end}}>
|
||
<div class="modal modal-narrow" role="dialog" aria-modal="true" aria-labelledby="change-password-title">
|
||
<div class="modal-head">
|
||
<h2 id="change-password-title">修改我的密码</h2>
|
||
<button type="button" class="modal-x" data-modal-close aria-label="关闭">×</button>
|
||
</div>
|
||
<form method="post" action="/account/change-password">
|
||
<div class="modal-body form-stack">
|
||
<p class="hint">修改成功后,这个管理员在所有浏览器中的登录都会失效,需要使用新密码重新登录。</p>
|
||
<div class="field">
|
||
<label for="current-password">当前密码</label>
|
||
<input id="current-password" type="password" name="current_password" required
|
||
autocomplete="current-password" {{if or (not .PasswordChangeField) (eq .PasswordChangeField "current_password")}}autofocus{{end}}
|
||
{{if eq .PasswordChangeField "current_password"}}aria-invalid="true" aria-describedby="current-password-error"{{end}}>
|
||
{{if eq .PasswordChangeField "current_password"}}<small id="current-password-error" class="field-error" role="alert">{{.PasswordChangeError}}</small>{{end}}
|
||
</div>
|
||
<div class="field">
|
||
<label for="changed-password">新密码</label>
|
||
<input id="changed-password" type="password" name="new_password" minlength="6"
|
||
maxlength="72" required autocomplete="new-password" {{if eq .PasswordChangeField "new_password"}}autofocus aria-invalid="true" aria-describedby="changed-password-error"{{end}}>
|
||
{{if eq .PasswordChangeField "new_password"}}
|
||
<small id="changed-password-error" class="field-error" role="alert">{{.PasswordChangeError}}</small>
|
||
{{else}}<small>至少 6 个字符,最多 72 个字节。</small>{{end}}
|
||
</div>
|
||
<div class="field">
|
||
<label for="changed-password-confirm">确认新密码</label>
|
||
<input id="changed-password-confirm" type="password" name="password_confirm"
|
||
minlength="6" maxlength="72" required autocomplete="new-password" {{if eq .PasswordChangeField "password_confirm"}}autofocus aria-invalid="true" aria-describedby="changed-password-confirm-error"{{end}}>
|
||
{{if eq .PasswordChangeField "password_confirm"}}<small id="changed-password-confirm-error" class="field-error" role="alert">{{.PasswordChangeError}}</small>{{end}}
|
||
</div>
|
||
<input type="hidden" name="next" value="{{.PasswordReturnPath}}">
|
||
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
|
||
</div>
|
||
<div class="modal-foot">
|
||
<button type="button" data-modal-close>取消</button>
|
||
<button type="submit" class="primary">修改密码</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
{{end}}
|
||
|
||
<main class="page">
|
||
{{end}}
|