75 lines
3.6 KiB
HTML
75 lines
3.6 KiB
HTML
{% extends "pages/base.html" %}
|
||
|
||
{% block title %}修改密码{% endblock %}
|
||
|
||
{% block content %}
|
||
<div class="profile-container">
|
||
<button class="back-btn" onclick="window.location.href='{{ url_for('home') }}'" title="返回主页">×</button>
|
||
<div class="profile-avatar">👨💻</div>
|
||
<h1>修改密码</h1>
|
||
|
||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||
{% if messages %}
|
||
<div class="flash-messages">
|
||
{% for category, message in messages %}
|
||
<div class="flash {{ category }}">{{ message }}</div>
|
||
{% endfor %}
|
||
</div>
|
||
{% endif %}
|
||
{% endwith %}
|
||
|
||
<form method="post">
|
||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||
<div class="form-group">
|
||
<label for="old_password" class="password-label">当前密码</label>
|
||
<div class="password-field-wrapper">
|
||
<div class="input-wrapper">
|
||
<input type="password" id="old_password" name="old_password" required placeholder="请输入当前密码" value="{{ request.form.get('old_password', '') }}">
|
||
<button type="button" class="password-toggle" onclick="togglePassword('old_password')" title="显示/隐藏密码">🙈</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label for="new_password" class="password-label">新密码</label>
|
||
<div class="password-field-wrapper">
|
||
<div class="input-wrapper">
|
||
<input type="password" id="new_password" name="new_password" required placeholder="请输入新密码(至少 6 位)" value="{{ request.form.get('new_password', '') }}">
|
||
<button type="button" class="password-toggle" onclick="togglePassword('new_password')" title="显示/隐藏密码">🙈</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label for="confirm_password" class="password-label">确认密码</label>
|
||
<div class="password-field-wrapper">
|
||
<div class="input-wrapper">
|
||
<input type="password" id="confirm_password" name="confirm_password" required placeholder="请再次输入新密码" value="{{ request.form.get('confirm_password', '') }}">
|
||
<button type="button" class="password-toggle" onclick="togglePassword('confirm_password')" title="显示/隐藏密码">🙈</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<button type="submit">修改密码</button>
|
||
<button type="button" class="logout-btn" onclick="window.location.href='{{ url_for('logout') }}'">退出登录</button>
|
||
</form>
|
||
</div>
|
||
{% endblock %}
|
||
|
||
{% block scripts %}
|
||
<script src="{{ url_for('static', filename='theme.js') }}"></script>
|
||
<script>
|
||
function togglePassword(fieldId) {
|
||
const passwordInput = document.getElementById(fieldId);
|
||
const inputWrapper = passwordInput.closest('.input-wrapper');
|
||
const toggleBtn = inputWrapper.querySelector('.password-toggle');
|
||
if (passwordInput.type === 'password') {
|
||
passwordInput.type = 'text';
|
||
toggleBtn.textContent = '👀';
|
||
} else {
|
||
passwordInput.type = 'password';
|
||
toggleBtn.textContent = '🙈';
|
||
}
|
||
}
|
||
</script>
|
||
{% endblock %}
|
||
</body>
|
||
</html>
|