load U2F js only on pages which need it (#11585)

* load U2F js only on pages which need it

* Update templates/base/head.tmpl
tokarchuk/v1.17
Kamil Domański 4 years ago committed by GitHub
parent cb08248c33
commit 26da20aa93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      routers/user/setting/security.go
  2. 1
      templates/base/head.tmpl

@ -21,6 +21,7 @@ const (
func Security(ctx *context.Context) { func Security(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings") ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["PageIsSettingsSecurity"] = true ctx.Data["PageIsSettingsSecurity"] = true
ctx.Data["RequireU2F"] = true
if ctx.Query("openid.return_to") != "" { if ctx.Query("openid.return_to") != "" {
settingsOpenIDVerify(ctx) settingsOpenIDVerify(ctx)
@ -68,7 +69,6 @@ func loadSecurityData(ctx *context.Context) {
ctx.ServerError("GetU2FRegistrationsByUID", err) ctx.ServerError("GetU2FRegistrationsByUID", err)
return return
} }
ctx.Data["RequireU2F"] = true
} }
tokens, err := models.ListAccessTokens(models.ListAccessTokensOptions{UserID: ctx.User.ID}) tokens, err := models.ListAccessTokens(models.ListAccessTokensOptions{UserID: ctx.User.ID})

@ -36,7 +36,6 @@
HighlightJS: {{if .RequireHighlightJS}}true{{else}}false{{end}}, HighlightJS: {{if .RequireHighlightJS}}true{{else}}false{{end}},
SimpleMDE: {{if .RequireSimpleMDE}}true{{else}}false{{end}}, SimpleMDE: {{if .RequireSimpleMDE}}true{{else}}false{{end}},
Tribute: {{if .RequireTribute}}true{{else}}false{{end}}, Tribute: {{if .RequireTribute}}true{{else}}false{{end}},
U2F: {{if .RequireU2F}}true{{else}}false{{end}},
NotificationSettings: { NotificationSettings: {
MinTimeout: {{NotificationSettings.MinTimeout}}, MinTimeout: {{NotificationSettings.MinTimeout}},
TimeoutStep: {{NotificationSettings.TimeoutStep}}, TimeoutStep: {{NotificationSettings.TimeoutStep}},

Loading…
Cancel
Save