mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-02 00:30:14 +08:00
🎨 Improve login auth https://github.com/siyuan-note/siyuan/issues/13757
This commit is contained in:
parent
4b4366268b
commit
879f50d0d5
@ -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)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user