This commit is contained in:
Liang Ding 2022-12-08 23:19:03 +08:00
parent 442c675be0
commit f5943cac15
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
7 changed files with 53 additions and 11 deletions

View file

@ -1007,6 +1007,10 @@
"168": "Uploading data repo snapshot %s",
"169": "Uploading data repo file %v",
"170": "Uploading data repo chunk %v",
"171": "Uploading data repo reference %s"
"171": "Uploading data repo reference %s",
"172": " If you forget the authorization code, you can search<br>for <code class=\"b3-code\">accessAuthCode</code> in the workspace conf/conf.json",
"173": "Please enter the access auth code",
"174": "Unlock access",
"175": "Please enter the verification code"
}
}

View file

@ -1007,6 +1007,10 @@
"168": "Cargando instantánea de repositorio de datos %s",
"169": "Cargando archivo de repositorio de datos %v",
"170": "Cargando fragmento de repositorio de datos %v",
"171": "Cargando referencia de repositorio de datos %s"
"171": "Cargando referencia de repositorio de datos %s",
"172": "Si olvida el código de autorización, puede buscar <code class=\"b3-code\">accessAuthCode</code> en el archivo <br>conf/conf.json del espacio de trabajo",
"173": "Por favor ingrese el codigo de autorizacion de acceso",
"174": "Desbloquear acceso",
"175": "Por favor ingrese el código de verificación"
}
}

View file

@ -1007,6 +1007,10 @@
"168": "Téléchargement de l'instantané du référentiel de données %s",
"169": "Téléchargement du fichier de référentiel de données %v",
"170": "Téléchargement du bloc de dépôt de données %v",
"171": "Téléchargement de la référence de référentiel de données %s"
"171": "Téléchargement de la référence de référentiel de données %s",
"172": "Si vous oubliez le code d'autorisation, vous pouvez rechercher <code class=\"b3-code\">accessAuthCode</code> dans le fichier <br>conf/conf.json de l'espace de travail",
"173": "Veuillez entrer le code d'autorisation d'accès",
"174": "Déverrouiller l'accès",
"175": "Veuillez entrer le code de vérification"
}
}

View file

@ -1007,6 +1007,10 @@
"168": "正在上傳數據倉庫快照 %s",
"169": "正在上傳數據倉庫文件 %v",
"170": "正在上傳數據倉庫分塊 %v",
"171": "正在上傳數據倉庫引用 %s"
"171": "正在上傳數據倉庫引用 %s",
"172": "如果你忘記了授權碼,可在工作空間<br>conf/conf.json 文件中搜索 <code class=\"b3-code\">accessAuthCode</code>",
"173": "請輸入訪問授權碼",
"174": "解鎖訪問",
"175": "請輸入驗證碼"
}
}

View file

@ -1007,6 +1007,10 @@
"168": "正在上传数据仓库快照 %s",
"169": "正在上传数据仓库文件 %v",
"170": "正在上传数据仓库分块 %v",
"171": "正在上传数据仓库引用 %s"
"171": "正在上传数据仓库引用 %s",
"172": "如果你忘记了授权码,可在工作空间<br>conf/conf.json 文件中搜索 <code class=\"b3-code\">accessAuthCode</code>",
"173": "请输入访问授权码",
"174": "解锁访问",
"175": "请输入验证码"
}
}

View file

@ -157,16 +157,15 @@
">
<div style="-webkit-app-region: drag;height: 32px;width: 100%;position: absolute;top: 0;"></div>
<div style="position: relative;z-index: 2;text-align: center">
<h1 style="margin-bottom: 48px;">思源 SiYuan</h1>
<input class="b3-text-filed" id="authCode" type="password" placeholder="授权码 Auth code"/><br>
<h1 style="margin-bottom: 48px;">SiYuan</h1>
<input class="b3-text-filed" id="authCode" type="password" placeholder="{{.l0}}"/><br>
<div style="position: relative;width: 240px;margin: 8px auto 0;display: none">
<img id="captchaImg" style="top: 1px;position: absolute;height: 28px;right: 1px;cursor: pointer">
<input id="captcha" class="b3-text-filed" placeholder="验证码 Captcha">
<input id="captcha" class="b3-text-filed" placeholder="{{.l3}}">
</div>
<button class="b3-button" onclick="submitAuth()">解锁 Unlock</button>
<button class="b3-button" onclick="submitAuth()">{{.l1}}</button>
<div style="color: #5f6368;font-size: 14px;margin: 16px 0;">
如果你忘记了授权码,可在工作空间<br>conf/conf.json 文件中搜索 <code class="b3-code">accessAuthCode</code><br><br>
If you forget the authorization code, you can search<br>for <code class="b3-code">accessAuthCode</code> in the workspace conf/conf.json
{{.l2}}
</div>
<button class="b3-button b3-button--white" onclick="exitSiYuan()">退出 Exit</button>
</div>

View file

@ -17,7 +17,9 @@
package server
import (
"bytes"
"fmt"
"html/template"
"net"
"net/http"
"net/http/httputil"
@ -267,6 +269,27 @@ func serveCheckAuth(c *gin.Context) {
c.Status(500)
return
}
tpl, err := template.New("auth").Parse(string(data))
if nil != err {
logging.LogErrorf("parse auth page failed: %s", err)
c.Status(500)
return
}
model := map[string]interface{}{
"l0": model.Conf.Language(173),
"l1": model.Conf.Language(174),
"l2": template.HTML(model.Conf.Language(172)),
"l3": model.Conf.Language(175),
}
buf := &bytes.Buffer{}
if err = tpl.Execute(buf, model); nil != err {
logging.LogErrorf("execute auth page failed: %s", err)
c.Status(500)
return
}
data = buf.Bytes()
c.Data(http.StatusOK, "text/html; charset=utf-8", data)
}