This commit is contained in:
Daniel 2025-01-09 11:46:03 +08:00
parent 4b4366268b
commit 879f50d0d5
No known key found for this signature in database
GPG Key ID: 86211BA83DF03017
2 changed files with 21 additions and 7 deletions

View File

@ -460,13 +460,31 @@
} }
} }
const showMessage = (msg)=> {
document.querySelector('#message').classList.add('b3-snackbar--show')
document.querySelector('#message').firstElementChild.innerHTML = msg
setTimeout(() => {
document.querySelector('#message').classList.remove('b3-snackbar--show')
document.querySelector('#message').firstElementChild.textContent = ''
}, 6000)
}
const submitAuth = () => { const submitAuth = () => {
const inputElement = document.getElementById('authCode') const inputElement = document.getElementById('authCode')
const captchaElement = document.getElementById('captcha') const captchaElement = document.getElementById('captcha')
let code = inputElement.value.trim();
if ("" === code) {
showMessage({{.l9}})
inputElement.value = ''
captchaElement.value = ''
inputElement.focus()
return
}
fetch('/api/system/loginAuth', { fetch('/api/system/loginAuth', {
method: 'POST', method: 'POST',
body: JSON.stringify({ body: JSON.stringify({
authCode: inputElement.value, authCode: code,
captcha: captchaElement.value, captcha: captchaElement.value,
}), }),
}).then((response) => { }).then((response) => {
@ -486,15 +504,10 @@
captchaElement.previousElementSibling.src = '' captchaElement.previousElementSibling.src = ''
} }
document.querySelector('#message').classList.add('b3-snackbar--show') showMessage(response.msg)
document.querySelector('#message').firstElementChild.textContent = response.msg
inputElement.value = '' inputElement.value = ''
captchaElement.value = '' captchaElement.value = ''
inputElement.focus() inputElement.focus()
setTimeout(() => {
document.querySelector('#message').classList.remove('b3-snackbar--show')
document.querySelector('#message').firstElementChild.textContent = ''
}, 6000)
}) })
} }

View File

@ -451,6 +451,7 @@ func serveAuthPage(c *gin.Context) {
"l6": model.Conf.Language(178), "l6": model.Conf.Language(178),
"l7": template.HTML(model.Conf.Language(184)), "l7": template.HTML(model.Conf.Language(184)),
"l8": model.Conf.Language(95), "l8": model.Conf.Language(95),
"l9": model.Conf.Language(83),
"appearanceMode": model.Conf.Appearance.Mode, "appearanceMode": model.Conf.Appearance.Mode,
"appearanceModeOS": model.Conf.Appearance.ModeOS, "appearanceModeOS": model.Conf.Appearance.ModeOS,
"workspace": util.WorkspaceName, "workspace": util.WorkspaceName,