From 6dd096b7f08799ff27d9e34356fb1163ca10f388 Mon Sep 17 00:00:00 2001 From: Andrew Date: Sun, 15 Jan 2017 21:14:29 -0500 Subject: Two factor authentication support (#630) * Initial commit for 2FA support Signed-off-by: Andrew * Add vendored files * Add missing depends * A few clean ups * Added improvements, proper encryption * Better encryption key * Simplify "key" generation * Make 2FA enrollment page more robust * Fix typo * Rename twofa/2FA to TwoFactor * UNIQUE INDEX -> UNIQUE --- templates/user/settings/navbar.tmpl | 3 ++ templates/user/settings/twofa.tmpl | 48 +++++++++++++++++++++++++++++++ templates/user/settings/twofa_enroll.tmpl | 33 +++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 templates/user/settings/twofa.tmpl create mode 100644 templates/user/settings/twofa_enroll.tmpl (limited to 'templates/user/settings') diff --git a/templates/user/settings/navbar.tmpl b/templates/user/settings/navbar.tmpl index 5166bafaba..7449fdbf7e 100644 --- a/templates/user/settings/navbar.tmpl +++ b/templates/user/settings/navbar.tmpl @@ -19,6 +19,9 @@ {{.i18n.Tr "settings.applications"}} + + {{.i18n.Tr "settings.twofa"}} + {{.i18n.Tr "settings.delete"}} diff --git a/templates/user/settings/twofa.tmpl b/templates/user/settings/twofa.tmpl new file mode 100644 index 0000000000..fd214e4f7f --- /dev/null +++ b/templates/user/settings/twofa.tmpl @@ -0,0 +1,48 @@ +{{template "base/head" .}} +
+
+
+ {{template "user/settings/navbar" .}} +
+ {{template "base/alert" .}} +

+ {{.i18n.Tr "settings.twofa"}} +

+
+

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

+ {{if .TwofaEnrolled}} +

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

+
+ {{.CsrfTokenHtml}} +

{{.i18n.Tr "settings.regenerate_scratch_token_desc"}}

+ +
+
+ {{.CsrfTokenHtml}} +

{{.i18n.Tr "settings.twofa_disable_note"}}

+
{{$.i18n.Tr "settings.twofa_disable"}}
+
+ {{else}} +

{{.i18n.Tr "settings.twofa_not_enrolled"}}

+ + {{end}} +
+
+
+
+
+ + + +{{template "base/footer" .}} diff --git a/templates/user/settings/twofa_enroll.tmpl b/templates/user/settings/twofa_enroll.tmpl new file mode 100644 index 0000000000..bc2dc271eb --- /dev/null +++ b/templates/user/settings/twofa_enroll.tmpl @@ -0,0 +1,33 @@ +{{template "base/head" .}} +
+
+
+ {{template "user/settings/navbar" .}} +
+ {{template "base/alert" .}} +

+ {{.i18n.Tr "settings.twofa_enroll"}} +

+
+

{{.i18n.Tr "settings.scan_this_image"}}

+ {{.TwofaSecret}} +

{{.i18n.Tr "settings.or_enter_secret" .TwofaSecret}} +

{{.i18n.Tr "settings.then_enter_passcode"}} +

+ {{.CsrfTokenHtml}} +
+ + +
+
+ + +
+
+
+
+
+
+
+ +{{template "base/footer" .}} -- cgit v1.2.3