🔖 dashboard v0.13.0 Globalization

This commit is contained in:
naiba
2022-04-30 00:48:39 +08:00
parent fe51b1afdc
commit ade06839b7
11 changed files with 52 additions and 13 deletions

View File

@@ -551,6 +551,7 @@ func (ma *memberAPI) logout(c *gin.Context) {
type settingForm struct {
Title string
Admin string
Language string
Theme string
CustomCode string
ViewPassword string
@@ -572,6 +573,7 @@ func (ma *memberAPI) updateSetting(c *gin.Context) {
})
return
}
singleton.Conf.Language = sf.Language
singleton.Conf.EnableIPChangeNotification = sf.EnableIPChangeNotification == "on"
singleton.Conf.EnablePlainIPInNotification = sf.EnablePlainIPInNotification == "on"
singleton.Conf.Cover = sf.Cover
@@ -594,6 +596,8 @@ func (ma *memberAPI) updateSetting(c *gin.Context) {
})
return
}
// 更新系统语言
singleton.InitLocalizer()
c.JSON(http.StatusOK, model.Response{
Code: http.StatusOK,
})

View File

@@ -108,7 +108,7 @@ func (oa *oauth2controller) callback(c *gin.Context) {
}
var isAdmin bool
for _, admin := range strings.Split(singleton.Conf.Oauth2.Admin, ",") {
if admin != "" && gu.GetLogin() == admin {
if admin != "" && strings.ToLower(gu.GetLogin()) == strings.ToLower(admin) {
isAdmin = true
break
}