aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamil DomaƄski <kamil@domanski.co>2021-01-20 22:17:46 +0100
committerGitHub <noreply@github.com>2021-01-20 21:17:46 +0000
commit26da20aa93b474b1bf47b2ab650e0252f88a41cd (patch)
tree53249840ebd77afce50cb124952349d778ca01dc
parentcb08248c33a9e0f57c1480d0289b632da5d77668 (diff)
downloadgitea-26da20aa93b474b1bf47b2ab650e0252f88a41cd.tar.gz
gitea-26da20aa93b474b1bf47b2ab650e0252f88a41cd.zip
load U2F js only on pages which need it (#11585)
* load U2F js only on pages which need it * Update templates/base/head.tmpl
-rw-r--r--routers/user/setting/security.go2
-rw-r--r--templates/base/head.tmpl1
2 files changed, 1 insertions, 2 deletions
diff --git a/routers/user/setting/security.go b/routers/user/setting/security.go
index 787ac922ec..87e2ba1c02 100644
--- a/routers/user/setting/security.go
+++ b/routers/user/setting/security.go
@@ -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)
@@ -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})
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index 3c2371f0e9..1dcaea8560 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -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}},