Skip to content

Commit e6dca6b

Browse files
committed
Make 'Default language' in SSPI config empty, unless changed by admin
1 parent be85ea7 commit e6dca6b

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

options/locale/locale_en-US.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1823,7 +1823,7 @@ auths.sspi_strip_domain_names_helper = If checked, domain names will be removed
18231823
auths.sspi_separator_replacement = Separator to use instead of \, / and @
18241824
auths.sspi_separator_replacement_helper = The character to use to replace the separators of down-level logon names (eg. the \ in "DOMAIN\user") and user principal names (eg. the @ in "[email protected]").
18251825
auths.sspi_default_language = Default user language
1826-
auths.sspi_default_language_helper = Default language for users automatically created by SSPI auth method
1826+
auths.sspi_default_language_helper = Default language for users automatically created by SSPI auth method. Leave empty if you prefer language to be automatically detected.
18271827
auths.tips = Tips
18281828
auths.tips.oauth2.general = OAuth2 Authentication
18291829
auths.tips.oauth2.general.tip = When registering a new OAuth2 authentication, the callback/redirect URL should be: <host>/user/oauth2/<Authentication Name>/callback

routers/admin/auths.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func NewAuthSource(ctx *context.Context) {
9494
ctx.Data["SSPIAutoActivateUsers"] = true
9595
ctx.Data["SSPIStripDomainNames"] = true
9696
ctx.Data["SSPISeparatorReplacement"] = "_"
97-
ctx.Data["SSPIDefaultLanguage"] = "en-US"
97+
ctx.Data["SSPIDefaultLanguage"] = ""
9898

9999
// only the first as default
100100
for key := range models.OAuth2Providers {
@@ -177,7 +177,7 @@ func parseSSPIConfig(ctx *context.Context, form auth.AuthenticationForm) (*model
177177
return nil, errors.New(ctx.Tr("form.SSPISeparatorReplacement") + ctx.Tr("form.alpha_dash_dot_error"))
178178
}
179179

180-
if !langCodePattern.MatchString(form.SSPIDefaultLanguage) {
180+
if !util.IsEmptyString(form.SSPIDefaultLanguage) && !langCodePattern.MatchString(form.SSPIDefaultLanguage) {
181181
ctx.Data["Err_SSPIDefaultLanguage"] = true
182182
return nil, errors.New(ctx.Tr("form.lang_select_error"))
183183
}
@@ -209,7 +209,7 @@ func NewAuthSourcePost(ctx *context.Context, form auth.AuthenticationForm) {
209209
ctx.Data["SSPIAutoActivateUsers"] = true
210210
ctx.Data["SSPIStripDomainNames"] = true
211211
ctx.Data["SSPISeparatorReplacement"] = "_"
212-
ctx.Data["SSPIDefaultLanguage"] = "en-US"
212+
ctx.Data["SSPIDefaultLanguage"] = ""
213213

214214
hasTLS := false
215215
var config core.Conversion

templates/admin/auth/edit.tmpl

+1
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@
249249
<i class="dropdown icon"></i>
250250
<div class="text">{{range .AllLangs}}{{if eq $cfg.DefaultLanguage .Lang}}{{.Name}}{{end}}{{end}}</div>
251251
<div class="menu">
252+
<div class="item{{if not $.SSPIDefaultLanguage}} active selected{{end}}" data-value="">-</div>
252253
{{range .AllLangs}}
253254
<div class="item{{if eq $cfg.DefaultLanguage .Lang}} active selected{{end}}" data-value="{{.Lang}}">{{.Name}}</div>
254255
{{end}}

templates/admin/auth/source/sspi.tmpl

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<i class="dropdown icon"></i>
3333
<div class="text">{{range .AllLangs}}{{if eq $.SSPIDefaultLanguage .Lang}}{{.Name}}{{end}}{{end}}</div>
3434
<div class="menu">
35+
<div class="item{{if not $.SSPIDefaultLanguage}} active selected{{end}}" data-value="">-</div>
3536
{{range .AllLangs}}
3637
<div class="item{{if eq $.SSPIDefaultLanguage .Lang}} active selected{{end}}" data-value="{{.Lang}}">{{.Name}}</div>
3738
{{end}}

0 commit comments

Comments
 (0)