feat: 登录机制改为账号+密码模式,默认账号root

This commit is contained in:
2026-04-22 15:58:59 +08:00
parent 51084de7e1
commit fa657940af
3 changed files with 13 additions and 6 deletions
+3 -1
View File
@@ -156,6 +156,8 @@ function showLoginModal() {
loginInput.focus();
const handleLogin = async () => {
const usernameInput = $('#loginUsername');
const username = usernameInput ? usernameInput.value : 'root';
const password = loginInput.value;
if (!password) {
showToast('请输入密码', 'warning');
@@ -166,7 +168,7 @@ function showLoginModal() {
loginBtn.textContent = '登录中...';
const res = await api('/login', {
method: 'POST',
body: JSON.stringify({ password })
body: JSON.stringify({ username, password })
});
if (res.success && res.token) {
localStorage.setItem('token', res.token);