- 新增登录页面 (templates/login.html) - HMAC-SHA256 cookie 认证中间件 - 所有页面和API需登录访问 - /health 保持公开 - 首页右上角退出按钮 - 默认账号 admin/admin123 - Cookie 有效期7天 - 版本升级至 v1.1.0
127 lines
2.7 KiB
HTML
127 lines
2.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>🦞 虾记 - 登录</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 50%, #f39c12 100%);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 20px;
|
|
}
|
|
|
|
.login-card {
|
|
background: #fff;
|
|
border-radius: 20px;
|
|
padding: 40px 32px;
|
|
width: 100%;
|
|
max-width: 380px;
|
|
box-shadow: 0 20px 60px rgba(0,0,0,.2);
|
|
animation: slideUp .4s ease;
|
|
}
|
|
|
|
@keyframes slideUp {
|
|
from { opacity: 0; transform: translateY(30px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
|
|
.login-logo {
|
|
text-align: center;
|
|
margin-bottom: 28px;
|
|
}
|
|
.login-logo .icon { font-size: 52px; }
|
|
.login-logo h1 {
|
|
font-size: 22px;
|
|
color: #333;
|
|
margin-top: 8px;
|
|
}
|
|
.login-logo .subtitle {
|
|
font-size: 13px;
|
|
color: #999;
|
|
margin-top: 4px;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 18px;
|
|
}
|
|
.form-group label {
|
|
display: block;
|
|
font-size: 13px;
|
|
color: #666;
|
|
margin-bottom: 6px;
|
|
font-weight: 500;
|
|
}
|
|
.form-group input {
|
|
width: 100%;
|
|
padding: 12px 16px;
|
|
border: 2px solid #eee;
|
|
border-radius: 10px;
|
|
font-size: 15px;
|
|
transition: border-color .2s;
|
|
outline: none;
|
|
}
|
|
.form-group input:focus {
|
|
border-color: #ee5a24;
|
|
}
|
|
|
|
.btn-login {
|
|
width: 100%;
|
|
padding: 13px;
|
|
background: linear-gradient(135deg, #ff6b6b, #ee5a24);
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 10px;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: opacity .2s, transform .1s;
|
|
margin-top: 6px;
|
|
}
|
|
.btn-login:hover { opacity: .9; }
|
|
.btn-login:active { transform: scale(.98); }
|
|
|
|
.error-msg {
|
|
background: #fff2f0;
|
|
color: #e74c3c;
|
|
padding: 10px 14px;
|
|
border-radius: 8px;
|
|
font-size: 13px;
|
|
margin-bottom: 16px;
|
|
text-align: center;
|
|
border: 1px solid #fde2e0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-card">
|
|
<div class="login-logo">
|
|
<div class="icon">🦞</div>
|
|
<h1>虾记记账</h1>
|
|
<div class="subtitle">Xiaji-Go 管理后台</div>
|
|
</div>
|
|
|
|
{{if .error}}
|
|
<div class="error-msg">{{.error}}</div>
|
|
{{end}}
|
|
|
|
<form method="POST" action="/login">
|
|
<div class="form-group">
|
|
<label>用户名</label>
|
|
<input type="text" name="username" placeholder="请输入用户名" autocomplete="username" autofocus required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>密码</label>
|
|
<input type="password" name="password" placeholder="请输入密码" autocomplete="current-password" required>
|
|
</div>
|
|
<button type="submit" class="btn-login">登 录</button>
|
|
</form>
|
|
</div>
|
|
</body>
|
|
</html>
|