Skip to content

Commit

Permalink
load U2F js only on pages which need it (#11585)
Browse files Browse the repository at this point in the history
* load U2F js only on pages which need it

* Update templates/base/head.tmpl
  • Loading branch information
kdomanski authored Jan 20, 2021
1 parent cb08248 commit 26da20a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion routers/user/setting/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const (
func Security(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["PageIsSettingsSecurity"] = true
ctx.Data["RequireU2F"] = true

if ctx.Query("openid.return_to") != "" {
settingsOpenIDVerify(ctx)
Expand Down Expand Up @@ -68,7 +69,6 @@ func loadSecurityData(ctx *context.Context) {
ctx.ServerError("GetU2FRegistrationsByUID", err)
return
}
ctx.Data["RequireU2F"] = true
}

tokens, err := models.ListAccessTokens(models.ListAccessTokensOptions{UserID: ctx.User.ID})
Expand Down
1 change: 0 additions & 1 deletion templates/base/head.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
HighlightJS: {{if .RequireHighlightJS}}true{{else}}false{{end}},
SimpleMDE: {{if .RequireSimpleMDE}}true{{else}}false{{end}},
Tribute: {{if .RequireTribute}}true{{else}}false{{end}},
U2F: {{if .RequireU2F}}true{{else}}false{{end}},
NotificationSettings: {
MinTimeout: {{NotificationSettings.MinTimeout}},
TimeoutStep: {{NotificationSettings.TimeoutStep}},
Expand Down

0 comments on commit 26da20a

Please sign in to comment.