Compare commits
No commits in common. "4003fd5bc1b58d5356c6c0f3d6b90a84a3ef0057" and "a8863f911b8d8dabaa12ffa88924f29fc8efb1d8" have entirely different histories.
4003fd5bc1
...
a8863f911b
@ -6,11 +6,11 @@
|
|||||||
<h2>🔐 登录信息</h2>
|
<h2>🔐 登录信息</h2>
|
||||||
<form method="post" action="/login">
|
<form method="post" action="/login">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="user" class="form-label" id="user-label">用户名</label>
|
<label for="user" class="form-label">用户名</label>
|
||||||
<input type="text" class="form-control" id="user" name="user">
|
<input type="text" class="form-control" id="user" name="user">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="pw" class="form-label" id="pw-label">密码</label>
|
<label for="pw" class="form-label">密码</label>
|
||||||
<input type="password" class="form-control" id="pw" name="pw">
|
<input type="password" class="form-control" id="pw" name="pw">
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
@ -38,31 +38,4 @@
|
|||||||
{% if message %}
|
{% if message %}
|
||||||
<div class="alert alert-{{ 'success' if success else 'danger' }} mt-4">{{ message }}</div>
|
<div class="alert alert-{{ 'success' if success else 'danger' }} mt-4">{{ message }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<script>
|
{% endblock %}
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
|
||||||
const tokenInput = document.getElementById('token');
|
|
||||||
const inputs = [document.getElementById('user'), document.getElementById('pw')];
|
|
||||||
const labels = [document.getElementById('user-label'), document.getElementById('pw-label')];
|
|
||||||
const fieldClasses = ['bg-body-secondary', 'text-body-secondary', 'text-decoration-line-through'];
|
|
||||||
|
|
||||||
function toggleCredFields() {
|
|
||||||
const inactive = tokenInput.value.trim() !== '';
|
|
||||||
inputs.forEach(el => {
|
|
||||||
el.readOnly = inactive;
|
|
||||||
el.tabIndex = inactive ? -1 : 0;
|
|
||||||
el.style.pointerEvents = inactive ? 'none' : '';
|
|
||||||
if (inactive && document.activeElement === el) {
|
|
||||||
el.blur();
|
|
||||||
}
|
|
||||||
fieldClasses.forEach(cls => el.classList.toggle(cls, inactive));
|
|
||||||
});
|
|
||||||
labels.forEach(el => {
|
|
||||||
['text-decoration-line-through', 'text-body-secondary'].forEach(cls => el.classList.toggle(cls, inactive));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
tokenInput.addEventListener('input', toggleCredFields);
|
|
||||||
toggleCredFields();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
Loading…
Reference in New Issue
Block a user