From 804e8c6de6f0a8d0fe619cae64ce8a1011278701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Doma=C5=84ski?= Date: Sat, 23 May 2020 15:45:57 +0200 Subject: [PATCH 1/2] load U2F js only on pages which need it --- routers/user/setting/security.go | 2 +- templates/base/head.tmpl | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/routers/user/setting/security.go b/routers/user/setting/security.go index c7c3226c9b231..21e96cf074232 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(ctx.User.ID, models.ListOptions{}) diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index a6a715531dd86..f972556508fb2 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -69,7 +69,6 @@ Minicolors: {{if .RequireMinicolors}}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}}, Heatmap: {{if .EnableHeatmap}}true{{else}}false{{end}}, heatmapUser: {{if .HeatmapUser}}'{{.HeatmapUser}}'{{else}}null{{end}}, NotificationSettings: { From 3fedba58270c6141410ca9058009b8d2c0b9c848 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 19 Jan 2021 05:32:39 +0100 Subject: [PATCH 2/2] Update templates/base/head.tmpl --- templates/base/head.tmpl | 2 -- 1 file changed, 2 deletions(-) diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index f07a25a9df1c2..1dcaea8560a00 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -36,8 +36,6 @@ HighlightJS: {{if .RequireHighlightJS}}true{{else}}false{{end}}, SimpleMDE: {{if .RequireSimpleMDE}}true{{else}}false{{end}}, Tribute: {{if .RequireTribute}}true{{else}}false{{end}}, - Heatmap: {{if .EnableHeatmap}}true{{else}}false{{end}}, - heatmapUser: {{if .HeatmapUser}}'{{.HeatmapUser}}'{{else}}null{{end}}, NotificationSettings: { MinTimeout: {{NotificationSettings.MinTimeout}}, TimeoutStep: {{NotificationSettings.TimeoutStep}},