261 lines
8.5 KiB
HTML
261 lines
8.5 KiB
HTML
{{ define "web/password" }}
|
|
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{{ .SystemConfig.WebsiteTitle }} - 访问密码</title>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
:root {
|
|
--primary: #7B8EA2;
|
|
--primary-dark: #6B7E92;
|
|
--text-primary: #2F343A;
|
|
--text-secondary: #6C737C;
|
|
--text-muted: #9CA3AF;
|
|
--bg: #F8F7F4;
|
|
--bg-card: #FFFFFF;
|
|
--border-color: #E5E3DF;
|
|
--shadow-sm: 0 0.06rem 0.12rem rgba(47, 52, 58, 0.04);
|
|
--shadow-md: 0 0.25rem 0.75rem rgba(47, 52, 58, 0.06);
|
|
--shadow-lg: 0 0.50rem 1.50rem rgba(47, 52, 58, 0.08);
|
|
--radius-sm: 0.38rem;
|
|
--radius-md: 0.62rem;
|
|
--radius-lg: 0.88rem;
|
|
}
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Noto Sans SC', sans-serif;
|
|
background-color: var(--bg);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.password-container {
|
|
background: var(--bg-card);
|
|
border-radius: var(--radius-lg);
|
|
padding: 3rem;
|
|
box-shadow: var(--shadow-lg);
|
|
width: 100%;
|
|
max-width: 26.25rem;
|
|
text-align: center;
|
|
border: 0.06rem solid var(--border-color);
|
|
}
|
|
.password-header {
|
|
margin-bottom: 2rem;
|
|
}
|
|
.password-logo {
|
|
width: 3.50rem;
|
|
height: 3.50rem;
|
|
margin: 0 auto 1.25rem;
|
|
background: var(--primary);
|
|
border-radius: var(--radius-md);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: white;
|
|
font-size: 1.8rem;
|
|
}
|
|
.password-logo img { width: 2.50rem; height: 2.50rem; border-radius: var(--radius-sm); object-cover; }
|
|
.password-title {
|
|
font-size: 1.15rem;
|
|
font-weight: 600;
|
|
color: var(--text-primary);
|
|
margin-bottom: 0.25rem;
|
|
}
|
|
.password-subtitle {
|
|
font-size: 0.9rem;
|
|
color: var(--text-secondary);
|
|
}
|
|
.password-icon {
|
|
width: 4.50rem;
|
|
height: 4.50rem;
|
|
background: rgba(123, 142, 162, 0.08);
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin: 0 auto 1.50rem;
|
|
font-size: 2rem;
|
|
color: var(--primary);
|
|
}
|
|
h1 {
|
|
font-size: 1.6rem;
|
|
color: var(--text-primary);
|
|
margin-bottom: 0.50rem;
|
|
font-weight: 600;
|
|
}
|
|
p {
|
|
color: var(--text-secondary);
|
|
margin-bottom: 2rem;
|
|
font-size: 0.95rem;
|
|
}
|
|
.form-group {
|
|
margin-bottom: 1.25rem;
|
|
text-align: left;
|
|
}
|
|
.form-group label {
|
|
display: block;
|
|
font-size: 0.85rem;
|
|
font-weight: 500;
|
|
color: var(--text-secondary);
|
|
margin-bottom: 0.50rem;
|
|
}
|
|
.form-group input {
|
|
width: 100%;
|
|
padding: 0.75rem 0.88rem;
|
|
border: 0.06rem solid var(--border-color);
|
|
border-radius: var(--radius-md);
|
|
font-size: 1rem;
|
|
transition: all 0.2s;
|
|
outline: none;
|
|
background: var(--bg);
|
|
}
|
|
.form-group input:focus {
|
|
border-color: var(--primary);
|
|
box-shadow: 0 0 0 0.19rem rgba(123, 142, 162, 0.1);
|
|
background: white;
|
|
}
|
|
.form-group input.error {
|
|
border-color: #ef4444;
|
|
}
|
|
.error-message {
|
|
color: #ef4444;
|
|
font-size: 0.85rem;
|
|
margin-top: 0.38rem;
|
|
display: none;
|
|
}
|
|
.btn {
|
|
width: 100%;
|
|
padding: 0.81rem;
|
|
background: var(--primary);
|
|
color: white;
|
|
border: none;
|
|
border-radius: var(--radius-md);
|
|
font-size: 0.95rem;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
}
|
|
.btn:hover {
|
|
background: var(--primary-dark);
|
|
transform: translateY(-0.06rem);
|
|
box-shadow: 0 0.25rem 0.75rem rgba(123, 142, 162, 0.2);
|
|
}
|
|
.btn:active {
|
|
transform: translateY(0);
|
|
}
|
|
.btn:disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
}
|
|
.loading-spinner {
|
|
display: inline-block;
|
|
width: 1.12rem;
|
|
height: 1.12rem;
|
|
border: 0.12rem solid rgba(255, 255, 255, 0.3);
|
|
border-radius: 50%;
|
|
border-top-color: white;
|
|
animation: spin 0.8s linear infinite;
|
|
margin-right: 0.50rem;
|
|
}
|
|
@keyframes spin {
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="password-container">
|
|
<div class="password-header">
|
|
<div class="password-logo">
|
|
{{ if .SystemConfig.LogoPath }}
|
|
<img src="{{.SystemConfig.LogoPath}}" alt="Logo">
|
|
{{ else }}
|
|
<i class="fas fa-file-alt"></i>
|
|
{{ end }}
|
|
</div>
|
|
<div class="password-title">{{ .SystemConfig.WebsiteTitle }}</div>
|
|
<div class="password-subtitle">{{ .SystemConfig.WebsiteDesc }}</div>
|
|
</div>
|
|
|
|
<div class="password-icon">
|
|
<i class="fas fa-lock"></i>
|
|
</div>
|
|
<h1>简历已加密</h1>
|
|
<p>请输入访问密码以查看这份简历</p>
|
|
|
|
<div class="form-group">
|
|
<label for="password">访问密码</label>
|
|
<input type="password" id="password" placeholder="请输入密码" onkeypress="handleKeyPress(event)">
|
|
<div class="error-message" id="errorMessage">密码错误,请重试</div>
|
|
</div>
|
|
|
|
<button class="btn" id="submitBtn" onclick="submitPassword()">
|
|
<span id="btnText">验证访问</span>
|
|
<span class="loading-spinner" id="loadingSpinner" style="display: none;"></span>
|
|
</button>
|
|
</div>
|
|
|
|
<script>
|
|
const passwordInput = document.getElementById('password');
|
|
const submitBtn = document.getElementById('submitBtn');
|
|
const btnText = document.getElementById('btnText');
|
|
const loadingSpinner = document.getElementById('loadingSpinner');
|
|
const errorMessage = document.getElementById('errorMessage');
|
|
|
|
function handleKeyPress(event) {
|
|
if (event.key === 'Enter') {
|
|
submitPassword();
|
|
}
|
|
}
|
|
|
|
async function submitPassword() {
|
|
const password = passwordInput.value.trim();
|
|
if (!password) {
|
|
return;
|
|
}
|
|
|
|
submitBtn.disabled = true;
|
|
btnText.textContent = '验证中...';
|
|
loadingSpinner.style.display = 'inline-block';
|
|
errorMessage.style.display = 'none';
|
|
passwordInput.classList.remove('error');
|
|
|
|
try {
|
|
const response = await fetch(window.location.pathname + '/verify-password', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
},
|
|
body: 'password=' + encodeURIComponent(password),
|
|
});
|
|
|
|
const result = await response.json();
|
|
|
|
if (result.success) {
|
|
window.location.reload();
|
|
} else {
|
|
errorMessage.textContent = result.message;
|
|
errorMessage.style.display = 'block';
|
|
passwordInput.classList.add('error');
|
|
passwordInput.value = '';
|
|
passwordInput.focus();
|
|
}
|
|
} catch (error) {
|
|
errorMessage.textContent = '验证失败,请重试';
|
|
errorMessage.style.display = 'block';
|
|
} finally {
|
|
submitBtn.disabled = false;
|
|
btnText.textContent = '验证访问';
|
|
loadingSpinner.style.display = 'none';
|
|
}
|
|
}
|
|
|
|
passwordInput.focus();
|
|
</script>
|
|
</body>
|
|
</html>{{ end }} |