From 021df29623bb0155b5a2ccad0e5f90fb348c8f4e Mon Sep 17 00:00:00 2001 From: Kamil DomaƄski Date: Mon, 8 Nov 2021 23:47:19 +0100 Subject: Allow U2F 2FA without TOTP (#11573) This change enables the usage of U2F without being forced to enroll an TOTP authenticator. The `/user/auth/u2f` has been changed to hide the "use TOTP instead" bar if TOTP is not enrolled. Fixes #5410 Fixes #17495 --- templates/user/settings/security_twofa.tmpl | 2 +- templates/user/settings/security_u2f.tmpl | 42 +++++++++++++---------------- 2 files changed, 20 insertions(+), 24 deletions(-) (limited to 'templates/user/settings') diff --git a/templates/user/settings/security_twofa.tmpl b/templates/user/settings/security_twofa.tmpl index f48b2f4cb2..3d6804d9c6 100644 --- a/templates/user/settings/security_twofa.tmpl +++ b/templates/user/settings/security_twofa.tmpl @@ -3,7 +3,7 @@

{{.i18n.Tr "settings.twofa_desc"}}

- {{if .TwofaEnrolled}} + {{if .TOTPEnrolled}}

{{$.i18n.Tr "settings.twofa_is_enrolled" | Str2html }}

{{.CsrfTokenHtml}} diff --git a/templates/user/settings/security_u2f.tmpl b/templates/user/settings/security_u2f.tmpl index 8fe01d8c70..a2ff6c2212 100644 --- a/templates/user/settings/security_u2f.tmpl +++ b/templates/user/settings/security_u2f.tmpl @@ -3,32 +3,28 @@

{{.i18n.Tr "settings.u2f_desc" | Str2html}}

- {{if .TwofaEnrolled}} -
- {{range .U2FRegistrations}} -
-
- -
-
- {{.Name}} -
+
+ {{range .U2FRegistrations}} +
+
+ +
+
+ {{.Name}}
- {{end}} -
-
- {{.CsrfTokenHtml}} -
- -
- + {{end}} +
+
+ {{.CsrfTokenHtml}} +
+ +
- {{else}} - {{.i18n.Tr "settings.u2f_require_twofa"}} - {{end}} + +