Skip to content

一分钟搭建影视站,支持Docker等部署方式

enhancement: 允许直接关闭管理员密码输入框

xwin859c0ae24c0e
diff --git a/index.html b/index.html
index cf256b5..8b3d106 100644
--- a/index.html
+++ b/index.html
@@ -342,7 +342,10 @@
<form id="passwordForm" onsubmit="handlePasswordSubmit(); return false;">
<input type="text" name="username" id="username" autocomplete="username" style="display:none" tabindex="-1" aria-hidden="true">
<input type="password" id="passwordInput" class="w-full bg-[#111] border border-[#333] text-white px-4 py-3 rounded-lg focus:outline-none focus:border-white transition-colors" placeholder="密码..." autocomplete="new-password">
- <button id="passwordSubmitBtn" type="submit" class="mt-4 w-full bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded">提交</button>
+ <div class="mt-4 w-full flex space-x-4">
+ <button id="passwordSubmitBtn" type="submit" class="flex-1 bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded">提交</button>
+ <button id="passwordCancelBtn" type="button" onclick="hidePasswordModal()" class="flex-1 bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded">取消</button>
+ </div>
</form>
<p id="passwordError" class="text-red-500 mt-2 hidden">密码错误,请重试</p>
</div>
diff --git a/js/password.js b/js/password.js
index 554dccc..98d21c9 100644
--- a/js/password.js
+++ b/js/password.js
@@ -101,6 +101,7 @@ function showPasswordModal() {
if (passwordModal) {
// 防止出现豆瓣区域滚动条
document.getElementById('doubanArea').classList.add('hidden');
+ document.getElementById('passwordCancelBtn').classList.add('hidden');
passwordModal.style.display = 'flex';
@@ -120,6 +121,13 @@ function showPasswordModal() {
function hidePasswordModal() {
const passwordModal = document.getElementById('passwordModal');
if (passwordModal) {
+ // 隐藏密码错误提示
+ hidePasswordError();
+
+ // 清空密码输入框
+ const passwordInput = document.getElementById('passwordInput');
+ if (passwordInput) passwordInput.value = '';
+
passwordModal.style.display = 'none';
// 如果启用豆瓣区域则显示豆瓣区域
@@ -157,7 +165,6 @@ async function handlePasswordSubmit() {
const passwordInput = document.getElementById('passwordInput');
const password = passwordInput ? passwordInput.value.trim() : '';
if (await verifyPassword(password)) {
- hidePasswordError();
hidePasswordModal();
// 触发密码验证成功事件
@@ -218,6 +225,8 @@ function showAdminPasswordModal() {
// 修改标题为管理员验证
const title = passwordModal.querySelector('h2');
if (title) title.textContent = '管理员验证';
+
+ document.getElementById('passwordCancelBtn').classList.remove('hidden');
passwordModal.style.display = 'flex';
// 设置表单提交处理