mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-04 15:58:49 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
0a7a7dcca7
5 changed files with 28 additions and 9 deletions
|
|
@ -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 inputElement = document.getElementById('authCode')
|
||||
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', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
authCode: inputElement.value,
|
||||
authCode: code,
|
||||
captcha: captchaElement.value,
|
||||
}),
|
||||
}).then((response) => {
|
||||
|
|
@ -486,15 +504,10 @@
|
|||
captchaElement.previousElementSibling.src = ''
|
||||
}
|
||||
|
||||
document.querySelector('#message').classList.add('b3-snackbar--show')
|
||||
document.querySelector('#message').firstElementChild.textContent = response.msg
|
||||
showMessage(response.msg)
|
||||
inputElement.value = ''
|
||||
captchaElement.value = ''
|
||||
inputElement.focus()
|
||||
setTimeout(() => {
|
||||
document.querySelector('#message').classList.remove('b3-snackbar--show')
|
||||
document.querySelector('#message').firstElementChild.textContent = ''
|
||||
}, 6000)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -564,6 +564,9 @@ func setAccessAuthCode(c *gin.Context) {
|
|||
aac = model.Conf.AccessAuthCode
|
||||
}
|
||||
|
||||
aac = strings.TrimSpace(aac)
|
||||
aac = util.RemoveInvalid(aac)
|
||||
|
||||
model.Conf.AccessAuthCode = aac
|
||||
model.Conf.Save()
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@ func LoginAuth(c *gin.Context) {
|
|||
}
|
||||
|
||||
authCode := arg["authCode"].(string)
|
||||
authCode = strings.TrimSpace(authCode)
|
||||
authCode = util.RemoveInvalid(authCode)
|
||||
|
||||
if Conf.AccessAuthCode != authCode {
|
||||
ret.Code = -1
|
||||
ret.Msg = Conf.Language(83)
|
||||
|
|
@ -437,7 +440,6 @@ func ControlConcurrency(c *gin.Context) {
|
|||
strings.HasPrefix(reqPath, "/appearance/") ||
|
||||
strings.HasPrefix(reqPath, "/export/") ||
|
||||
strings.HasPrefix(reqPath, "/history/") ||
|
||||
|
||||
strings.HasPrefix(reqPath, "/api/query/") ||
|
||||
strings.HasPrefix(reqPath, "/api/search/") ||
|
||||
strings.HasPrefix(reqPath, "/api/network/") ||
|
||||
|
|
|
|||
|
|
@ -648,7 +648,7 @@ func formatRepoErrorMsg(err error) string {
|
|||
msgLowerCase := strings.ToLower(msg)
|
||||
if strings.Contains(msgLowerCase, "permission denied") || strings.Contains(msg, "access is denied") {
|
||||
msg = Conf.Language(33)
|
||||
} else if strings.Contains(msgLowerCase, "region was not a valid DNS name") {
|
||||
} else if strings.Contains(msgLowerCase, "region was not a valid") {
|
||||
msg = Conf.language(254)
|
||||
} else if strings.Contains(msgLowerCase, "device or resource busy") || strings.Contains(msg, "is being used by another") {
|
||||
msg = fmt.Sprintf(Conf.Language(85), err)
|
||||
|
|
|
|||
|
|
@ -451,6 +451,7 @@ func serveAuthPage(c *gin.Context) {
|
|||
"l6": model.Conf.Language(178),
|
||||
"l7": template.HTML(model.Conf.Language(184)),
|
||||
"l8": model.Conf.Language(95),
|
||||
"l9": model.Conf.Language(83),
|
||||
"appearanceMode": model.Conf.Appearance.Mode,
|
||||
"appearanceModeOS": model.Conf.Appearance.ModeOS,
|
||||
"workspace": util.WorkspaceName,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue