diff --git a/hubcmdui/README.md b/hubcmdui/README.md index 591f14d..e713bb4 100644 --- a/hubcmdui/README.md +++ b/hubcmdui/README.md @@ -91,7 +91,7 @@ docker logs -f [容器ID或名称]
| - | + | @@ -424,6 +425,7 @@ linkInput.disabled = false; button.textContent = '保存'; editingIndex = row.getAttribute('data-index'); + console.log(`Editing ad at index ${editingIndex}:`, { url: urlInput.value, link: linkInput.value }); } else { const url = urlInput.value || ''; const link = linkInput.value || ''; @@ -546,6 +548,7 @@ } async function saveAd(index, ad) { + console.log(`Saving ad at index ${index}:`, ad); const config = { adImages: adImages }; config.adImages[index] = ad; await saveConfig(config); @@ -629,7 +632,7 @@ async function changePassword() { const currentPassword = document.getElementById('currentPassword').value; const newPassword = document.getElementById('newPassword').value; - const passwordRegex = /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,16}$/; + const passwordRegex = /^(?=.*[A-Za-z])(?=.*\d)(?=.*[.,\-_+=()[\]{}|\\;:'"<>?/@$!%*#?&])[A-Za-z\d.,\-_+=()[\]{}|\\;:'"<>?/@$!%*#?&]{8,16}$/; if (!currentPassword || !newPassword) { alert('请填写当前密码和新密码'); @@ -647,6 +650,17 @@ }); if (response.ok) { alert('密码已修改'); + // 清除当前会话并显示登录模态框 + localStorage.removeItem('isLoggedIn'); + isLoggedIn = false; + document.getElementById('loginModal').style.display = 'block'; + document.getElementById('adminContainer').classList.add('hidden'); + refreshCaptcha(); + + // 清除登录表单中的输入数据 + document.getElementById('username').value = ''; + document.getElementById('password').value = ''; + document.getElementById('captcha').value = ''; } else { alert('修改密码失败'); } @@ -659,7 +673,7 @@ const newPassword = document.getElementById('newPassword').value; const passwordHint = document.getElementById('passwordHint'); - const passwordRegex = /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,16}$/; + const passwordRegex = /^(?=.*[A-Za-z])(?=.*\d)(?=.*[.,\-_+=()[\]{}|\\;:'"<>?/@$!%*#?&])[A-Za-z\d.,\-_+=()[\]{}|\\;:'"<>?/@$!%*#?&]{8,16}$/; if (!passwordRegex.test(newPassword)) { passwordHint.style.display = 'block'; @@ -670,28 +684,28 @@ // 页面加载时检查登录状态 window.onload = async function() { - try { - const response = await fetch('/api/check-session'); - if (response.ok) { - isLoggedIn = localStorage.getItem('isLoggedIn') === 'true'; - if (isLoggedIn) { - document.getElementById('loginModal').style.display = 'none'; - document.getElementById('adminContainer').classList.remove('hidden'); - loadConfig(); - } else { + try { + const response = await fetch('/api/check-session'); + if (response.ok) { + isLoggedIn = localStorage.getItem('isLoggedIn') === 'true'; + if (isLoggedIn) { + document.getElementById('loginModal').style.display = 'none'; + document.getElementById('adminContainer').classList.remove('hidden'); + loadConfig(); + } else { + document.getElementById('loginModal').style.display = 'block'; + refreshCaptcha(); + } + } else { + localStorage.removeItem('isLoggedIn'); + document.getElementById('loginModal').style.display = 'block'; + refreshCaptcha(); + } + } catch (error) { + localStorage.removeItem('isLoggedIn'); document.getElementById('loginModal').style.display = 'block'; refreshCaptcha(); } - } else { - localStorage.removeItem('isLoggedIn'); - document.getElementById('loginModal').style.display = 'block'; - refreshCaptcha(); - } - } catch (error) { - localStorage.removeItem('isLoggedIn'); - document.getElementById('loginModal').style.display = 'block'; - refreshCaptcha(); - } }; function updateAdImage(adImages) { diff --git a/install/DockerProxy_Install.sh b/install/DockerProxy_Install.sh index 465ea82..287ffe8 100644 --- a/install/DockerProxy_Install.sh +++ b/install/DockerProxy_Install.sh @@ -1809,7 +1809,7 @@ INFO "请用浏览器访问 HubCMD-UI 面板: " INFO "公网访问地址: ${UNDERLINE}http://$PUBLIC_IP:30080${RESET}" INFO "内网访问地址: ${UNDERLINE}http://$INTERNAL_IP:30080${RESET}" INFO -INFO "后端访问地址: 地址后面跟admin,例: ${UNDERLINE}http://$INTERNAL_IP/admin:30080${RESET}" +INFO "后端访问地址: 地址后面跟admin,例: ${UNDERLINE}http://$INTERNAL_IP:30080/admin${RESET}" INFO "默认账号密码: ${LIGHT_GREEN}root${RESET}/${LIGHT_CYAN}admin${RESET}" INFO INFO "服务安装路径: ${LIGHT_BLUE}${CMDUI_DIR}${RESET}" |