167 lines
5.7 KiB
HTML
167 lines
5.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>
|
|
:root {
|
|
--primary-color: #2c3e50;
|
|
--accent-color: #42b983;
|
|
--error-color: #e74c3c;
|
|
}
|
|
body {
|
|
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
background: #f5f5f5;
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
padding: 2rem;
|
|
margin: 0;
|
|
}
|
|
.login-container {
|
|
background: white;
|
|
padding: 2.5rem;
|
|
border-radius: 12px;
|
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
width: 100%;
|
|
max-width: 500px;
|
|
margin-top: 4rem;
|
|
}
|
|
h1 {
|
|
color: var(--primary-color);
|
|
text-align: center;
|
|
margin-bottom: 2rem;
|
|
font-size: 1.8rem;
|
|
}
|
|
.form-group {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.5rem;
|
|
margin-bottom: 1rem;
|
|
}
|
|
label {
|
|
color: var(--primary-color);
|
|
font-weight: 500;
|
|
}
|
|
input, select {
|
|
padding: 0.8rem;
|
|
border: 1px solid #ddd;
|
|
border-radius: 6px;
|
|
font-size: 1rem;
|
|
transition: border-color 0.3s ease;
|
|
}
|
|
input:focus, select:focus {
|
|
outline: none;
|
|
border-color: var(--accent-color);
|
|
box-shadow: 0 0 0 2px rgba(66, 185, 131, 0.2);
|
|
}
|
|
button {
|
|
background: var(--accent-color);
|
|
color: white;
|
|
padding: 0.8rem;
|
|
border: none;
|
|
border-radius: 6px;
|
|
font-size: 1rem;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: background 0.3s ease;
|
|
width: 100%;
|
|
margin-top: 1rem;
|
|
}
|
|
button:hover {
|
|
background: #3aa876;
|
|
}
|
|
.error-message {
|
|
background: #fee;
|
|
color: var(--error-color);
|
|
padding: 1rem;
|
|
border-radius: 6px;
|
|
border: 1px solid #ffd6d6;
|
|
margin-top: 1rem;
|
|
text-align: center;
|
|
}
|
|
.password-match-error {
|
|
color: var(--error-color);
|
|
font-size: 0.875rem;
|
|
margin-top: 0.25rem;
|
|
display: none;
|
|
}
|
|
.password-match-error.show {
|
|
display: block;
|
|
}
|
|
@media (max-width: 480px) {
|
|
.login-container {
|
|
padding: 1.5rem;
|
|
margin-top: 2rem;
|
|
width: calc(100% - 2rem);
|
|
}
|
|
body {
|
|
padding: 1rem;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-container">
|
|
<h1>重置密码</h1>
|
|
<form action="/forgot-password" method="post" id="forgotPasswordForm">
|
|
<div class="form-group">
|
|
<label for="region">所在地区</label>
|
|
<select name="region" id="region" required>
|
|
<option value="">请选择所在地区</option>
|
|
{{ range .regions }}
|
|
<option value="{{ .ID }}">{{ .Name }}</option>
|
|
{{ end }}
|
|
</select>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="fullname">真实姓名</label>
|
|
<input type="text" id="fullname" name="fullname" required placeholder="请输入真实姓名">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="mobile">手机号码</label>
|
|
<input type="tel" id="mobile" name="mobile" required pattern="[0-9]{11}" placeholder="请输入11位手机号">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="password">新密码</label>
|
|
<input type="password" id="password" name="password" required minlength="6" placeholder="至少6位密码">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="confirmPassword">确认新密码</label>
|
|
<input type="password" id="confirmPassword" name="confirmPassword" required minlength="6" placeholder="请再次输入新密码">
|
|
<div class="password-match-error">两次输入的密码不一致</div>
|
|
</div>
|
|
<button type="submit">提交</button>
|
|
<div class="login-link" style="text-align:center;margin-top:1.5rem;">
|
|
<a href="/login">返回登录</a>
|
|
</div>
|
|
</form>
|
|
{{ if .error }}
|
|
<p class="error-message">{{ .error }}</p>
|
|
{{ end }}
|
|
</div>
|
|
<script>
|
|
const form = document.getElementById('forgotPasswordForm');
|
|
const password = document.getElementById('password');
|
|
const confirmPassword = document.getElementById('confirmPassword');
|
|
const errorDiv = document.querySelector('.password-match-error');
|
|
function checkPasswords() {
|
|
if (confirmPassword.value && password.value !== confirmPassword.value) {
|
|
errorDiv.classList.add('show');
|
|
return false;
|
|
}
|
|
errorDiv.classList.remove('show');
|
|
return true;
|
|
}
|
|
confirmPassword.addEventListener('input', checkPasswords);
|
|
password.addEventListener('input', checkPasswords);
|
|
form.addEventListener('submit', function(e) {
|
|
if (!checkPasswords()) {
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |