From de8e3948a5e38f7eaf82d3c0cfd10e995bf68e92 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 2 Jan 2022 21:12:35 +0800 Subject: Refactor auth package (#17962) --- templates/user/settings/security.tmpl | 15 ------ templates/user/settings/security/accountlinks.tmpl | 36 +++++++++++++ templates/user/settings/security/openid.tmpl | 63 ++++++++++++++++++++++ templates/user/settings/security/security.tmpl | 15 ++++++ templates/user/settings/security/twofa.tmpl | 35 ++++++++++++ templates/user/settings/security/twofa_enroll.tmpl | 29 ++++++++++ templates/user/settings/security/u2f.tmpl | 51 ++++++++++++++++++ templates/user/settings/security_accountlinks.tmpl | 36 ------------- templates/user/settings/security_openid.tmpl | 63 ---------------------- templates/user/settings/security_twofa.tmpl | 35 ------------ templates/user/settings/security_u2f.tmpl | 51 ------------------ templates/user/settings/twofa_enroll.tmpl | 29 ---------- 12 files changed, 229 insertions(+), 229 deletions(-) delete mode 100644 templates/user/settings/security.tmpl create mode 100644 templates/user/settings/security/accountlinks.tmpl create mode 100644 templates/user/settings/security/openid.tmpl create mode 100644 templates/user/settings/security/security.tmpl create mode 100644 templates/user/settings/security/twofa.tmpl create mode 100644 templates/user/settings/security/twofa_enroll.tmpl create mode 100644 templates/user/settings/security/u2f.tmpl delete mode 100644 templates/user/settings/security_accountlinks.tmpl delete mode 100644 templates/user/settings/security_openid.tmpl delete mode 100644 templates/user/settings/security_twofa.tmpl delete mode 100644 templates/user/settings/security_u2f.tmpl delete mode 100644 templates/user/settings/twofa_enroll.tmpl (limited to 'templates/user/settings') diff --git a/templates/user/settings/security.tmpl b/templates/user/settings/security.tmpl deleted file mode 100644 index 891f7b9535..0000000000 --- a/templates/user/settings/security.tmpl +++ /dev/null @@ -1,15 +0,0 @@ -{{template "base/head" .}} -
- {{template "user/settings/navbar" .}} -
- {{template "base/alert" .}} - {{template "user/settings/security_twofa" .}} - {{template "user/settings/security_u2f" .}} - {{template "user/settings/security_accountlinks" .}} - {{if .EnableOpenIDSignIn}} - {{template "user/settings/security_openid" .}} - {{end}} -
-
- -{{template "base/footer" .}} diff --git a/templates/user/settings/security/accountlinks.tmpl b/templates/user/settings/security/accountlinks.tmpl new file mode 100644 index 0000000000..7a9935d031 --- /dev/null +++ b/templates/user/settings/security/accountlinks.tmpl @@ -0,0 +1,36 @@ +

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

+
+
+
+ {{.i18n.Tr "settings.manage_account_links_desc"}} +
+ {{if .AccountLinks}} + {{range $loginSource, $provider := .AccountLinks}} +
+
+ +
+
+ {{$provider}} + {{if $loginSource.IsActive}}{{$.i18n.Tr "settings.active"}}{{end}} +
+
+ {{end}} + {{end}} +
+
+ + diff --git a/templates/user/settings/security/openid.tmpl b/templates/user/settings/security/openid.tmpl new file mode 100644 index 0000000000..2a167a712b --- /dev/null +++ b/templates/user/settings/security/openid.tmpl @@ -0,0 +1,63 @@ +

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

+
+
+
+ {{.i18n.Tr "settings.openid_desc"}} +
+ {{range .OpenIDs}} +
+
+ +
+
+
+ {{$.CsrfTokenHtml}} + + {{if .Show}} + + {{else}} + + {{end}} + +
+
+
+ {{.URI}} +
+
+ {{end}} +
+
+
+
+ {{.CsrfTokenHtml}} +
+ + +
+ +
+
+ + diff --git a/templates/user/settings/security/security.tmpl b/templates/user/settings/security/security.tmpl new file mode 100644 index 0000000000..6d5f38ab70 --- /dev/null +++ b/templates/user/settings/security/security.tmpl @@ -0,0 +1,15 @@ +{{template "base/head" .}} +
+ {{template "user/settings/navbar" .}} +
+ {{template "base/alert" .}} + {{template "user/settings/security/twofa" .}} + {{template "user/settings/security/u2f" .}} + {{template "user/settings/security/accountlinks" .}} + {{if .EnableOpenIDSignIn}} + {{template "user/settings/security/openid" .}} + {{end}} +
+
+ +{{template "base/footer" .}} diff --git a/templates/user/settings/security/twofa.tmpl b/templates/user/settings/security/twofa.tmpl new file mode 100644 index 0000000000..3d6804d9c6 --- /dev/null +++ b/templates/user/settings/security/twofa.tmpl @@ -0,0 +1,35 @@ +

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

+
+

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

+ {{if .TOTPEnrolled}} +

{{$.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}} +
+ + diff --git a/templates/user/settings/security/twofa_enroll.tmpl b/templates/user/settings/security/twofa_enroll.tmpl new file mode 100644 index 0000000000..c8ed0b7761 --- /dev/null +++ b/templates/user/settings/security/twofa_enroll.tmpl @@ -0,0 +1,29 @@ +{{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" .}} diff --git a/templates/user/settings/security/u2f.tmpl b/templates/user/settings/security/u2f.tmpl new file mode 100644 index 0000000000..97e76b6da2 --- /dev/null +++ b/templates/user/settings/security/u2f.tmpl @@ -0,0 +1,51 @@ +

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

+
+

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

+
+ {{range .U2FRegistrations}} +
+
+ +
+
+ {{.Name}} +
+
+ {{end}} +
+
+ {{.CsrfTokenHtml}} +
+ + +
+ +
+
+ + + +{{template "user/auth/u2f_error" .}} + + diff --git a/templates/user/settings/security_accountlinks.tmpl b/templates/user/settings/security_accountlinks.tmpl deleted file mode 100644 index 7a9935d031..0000000000 --- a/templates/user/settings/security_accountlinks.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -

- {{.i18n.Tr "settings.manage_account_links"}} -

-
-
-
- {{.i18n.Tr "settings.manage_account_links_desc"}} -
- {{if .AccountLinks}} - {{range $loginSource, $provider := .AccountLinks}} -
-
- -
-
- {{$provider}} - {{if $loginSource.IsActive}}{{$.i18n.Tr "settings.active"}}{{end}} -
-
- {{end}} - {{end}} -
-
- - diff --git a/templates/user/settings/security_openid.tmpl b/templates/user/settings/security_openid.tmpl deleted file mode 100644 index 2a167a712b..0000000000 --- a/templates/user/settings/security_openid.tmpl +++ /dev/null @@ -1,63 +0,0 @@ -

- {{.i18n.Tr "settings.manage_openid"}} -

-
-
-
- {{.i18n.Tr "settings.openid_desc"}} -
- {{range .OpenIDs}} -
-
- -
-
-
- {{$.CsrfTokenHtml}} - - {{if .Show}} - - {{else}} - - {{end}} - -
-
-
- {{.URI}} -
-
- {{end}} -
-
-
-
- {{.CsrfTokenHtml}} -
- - -
- -
-
- - diff --git a/templates/user/settings/security_twofa.tmpl b/templates/user/settings/security_twofa.tmpl deleted file mode 100644 index 3d6804d9c6..0000000000 --- a/templates/user/settings/security_twofa.tmpl +++ /dev/null @@ -1,35 +0,0 @@ -

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

-
-

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

- {{if .TOTPEnrolled}} -

{{$.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}} -
- - diff --git a/templates/user/settings/security_u2f.tmpl b/templates/user/settings/security_u2f.tmpl deleted file mode 100644 index 97e76b6da2..0000000000 --- a/templates/user/settings/security_u2f.tmpl +++ /dev/null @@ -1,51 +0,0 @@ -

-{{.i18n.Tr "settings.u2f"}} -

-
-

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

-
- {{range .U2FRegistrations}} -
-
- -
-
- {{.Name}} -
-
- {{end}} -
-
- {{.CsrfTokenHtml}} -
- - -
- -
-
- - - -{{template "user/auth/u2f_error" .}} - - diff --git a/templates/user/settings/twofa_enroll.tmpl b/templates/user/settings/twofa_enroll.tmpl deleted file mode 100644 index c8ed0b7761..0000000000 --- a/templates/user/settings/twofa_enroll.tmpl +++ /dev/null @@ -1,29 +0,0 @@ -{{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