From 099372d76c411c598285d637bd85c9b2dbc40948 Mon Sep 17 00:00:00 2001 From: David Schneiderbauer Date: Tue, 15 May 2018 12:07:32 +0200 Subject: Refactor User Settings (#3900) * moved avatar to profile page * combined password change, email and account deletion into account settings page * combined totp, access tokens, linked accounts and openid into security settings page * move access tokens to applications settings page * small change to restart drone build * fix change avatar url on profile page * redirect old settings urls to new ones * enforce only one autofocus attribute on settings pages * set correct redirect status code * fmt fix --- templates/user/profile.tmpl | 2 +- templates/user/settings/account.tmpl | 135 +++++++++++++++++++++ templates/user/settings/account_link.tmpl | 44 ------- templates/user/settings/applications.tmpl | 33 ++--- templates/user/settings/avatar.tmpl | 46 ------- templates/user/settings/delete.tmpl | 41 ------- templates/user/settings/email.tmpl | 66 ---------- templates/user/settings/navbar.tmpl | 22 +--- templates/user/settings/openid.tmpl | 71 ----------- templates/user/settings/organization.tmpl | 2 +- templates/user/settings/profile.tmpl | 37 ++++++ templates/user/settings/repos.tmpl | 2 +- templates/user/settings/security.tmpl | 77 +----------- templates/user/settings/security_accountlinks.tmpl | 36 ++++++ templates/user/settings/security_openid.tmpl | 63 ++++++++++ templates/user/settings/security_twofa.tmpl | 35 ++++++ templates/user/settings/twofa.tmpl | 44 ------- templates/user/settings/twofa_enroll.tmpl | 2 +- 18 files changed, 337 insertions(+), 421 deletions(-) create mode 100644 templates/user/settings/account.tmpl delete mode 100644 templates/user/settings/account_link.tmpl delete mode 100644 templates/user/settings/avatar.tmpl delete mode 100644 templates/user/settings/delete.tmpl delete mode 100644 templates/user/settings/email.tmpl delete mode 100644 templates/user/settings/openid.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_twofa.tmpl delete mode 100644 templates/user/settings/twofa.tmpl (limited to 'templates') diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 669ee3264b..837f8bd949 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -5,7 +5,7 @@
{{if eq .SignedUserName .Owner.Name}} - + {{else}} diff --git a/templates/user/settings/account.tmpl b/templates/user/settings/account.tmpl new file mode 100644 index 0000000000..290745222d --- /dev/null +++ b/templates/user/settings/account.tmpl @@ -0,0 +1,135 @@ +{{template "base/head" .}} + + + + + + +{{template "base/footer" .}} diff --git a/templates/user/settings/account_link.tmpl b/templates/user/settings/account_link.tmpl deleted file mode 100644 index 81ddf626e1..0000000000 --- a/templates/user/settings/account_link.tmpl +++ /dev/null @@ -1,44 +0,0 @@ -{{template "base/head" .}} - - - -{{template "base/footer" .}} diff --git a/templates/user/settings/applications.tmpl b/templates/user/settings/applications.tmpl index 4ad5eaa714..f1a3e48115 100644 --- a/templates/user/settings/applications.tmpl +++ b/templates/user/settings/applications.tmpl @@ -1,8 +1,7 @@ {{template "base/head" .}} -
+
{{template "user/settings/navbar" .}}
- {{template "base/alert" .}}

{{.i18n.Tr "settings.manage_access_token"}}

@@ -13,26 +12,26 @@
{{range .Tokens}}
-
- -
- -
- {{.Name}} -
- {{$.i18n.Tr "settings.add_on"}} {{.CreatedUnix.FormatShort}} {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} {{.UpdatedUnix.FormatShort}}{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}} -
+
+ +
+ {{.Name}} +
+ {{$.i18n.Tr "settings.add_on"}} {{.CreatedUnix.FormatShort}} {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} {{.UpdatedUnix.FormatShort}}{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}
+
{{end}}
-

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

-
+
+
+ {{.i18n.Tr "settings.generate_new_token"}} +

{{.i18n.Tr "settings.new_token_desc"}}

{{.CsrfTokenHtml}} @@ -48,7 +47,7 @@
- + + {{template "base/footer" .}} diff --git a/templates/user/settings/avatar.tmpl b/templates/user/settings/avatar.tmpl deleted file mode 100644 index 72d2eb6ad4..0000000000 --- a/templates/user/settings/avatar.tmpl +++ /dev/null @@ -1,46 +0,0 @@ -{{template "base/head" .}} -
- {{template "user/settings/navbar" .}} -
- {{template "base/alert" .}} -

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

-
- - - {{.CsrfTokenHtml}} - {{if not DisableGravatar}} -
-
- - -
-
-
- - -
- {{end}} - -
-
- - -
-
- -
- - -
- -
- - {{$.i18n.Tr "settings.delete_current_avatar"}} -
- -
-
-
-{{template "base/footer" .}} diff --git a/templates/user/settings/delete.tmpl b/templates/user/settings/delete.tmpl deleted file mode 100644 index 76ac7233bd..0000000000 --- a/templates/user/settings/delete.tmpl +++ /dev/null @@ -1,41 +0,0 @@ -{{template "base/head" .}} -
- {{template "user/settings/navbar" .}} -
- {{template "base/alert" .}} -

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

-
-
-

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

-
-
- {{.CsrfTokenHtml}} - -
- - -
-
-
- {{.i18n.Tr "settings.confirm_delete_account"}} -
- {{.i18n.Tr "auth.forgot_password"}} -
-
-
-
-
- - -{{template "base/footer" .}} diff --git a/templates/user/settings/email.tmpl b/templates/user/settings/email.tmpl deleted file mode 100644 index 62dc1d5e59..0000000000 --- a/templates/user/settings/email.tmpl +++ /dev/null @@ -1,66 +0,0 @@ -{{template "base/head" .}} -
- {{template "user/settings/navbar" .}} -
- {{template "base/alert" .}} -

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

-
- -
-
-
- {{.CsrfTokenHtml}} -
- - -
- -
-
-
-
- - -{{template "base/footer" .}} diff --git a/templates/user/settings/navbar.tmpl b/templates/user/settings/navbar.tmpl index 4e0c7048ee..18bd9a4f8d 100644 --- a/templates/user/settings/navbar.tmpl +++ b/templates/user/settings/navbar.tmpl @@ -2,28 +2,17 @@ {{.i18n.Tr "settings.profile"}} - - {{.i18n.Tr "settings.avatar"}} + + {{.i18n.Tr "settings.account"}} {{.i18n.Tr "settings.security"}} - - {{.i18n.Tr "settings.emails"}} - - {{if .EnableOpenIDSignIn}} - - OpenID - - {{end}} - - {{.i18n.Tr "settings.ssh_gpg_keys"}} - {{.i18n.Tr "settings.applications"}} - - {{.i18n.Tr "settings.account_link"}} + + {{.i18n.Tr "settings.ssh_gpg_keys"}} {{.i18n.Tr "settings.organization"}} @@ -31,7 +20,4 @@ {{.i18n.Tr "settings.repos"}} - - {{.i18n.Tr "settings.delete"}} -
diff --git a/templates/user/settings/openid.tmpl b/templates/user/settings/openid.tmpl deleted file mode 100644 index 6ae4a8dee8..0000000000 --- a/templates/user/settings/openid.tmpl +++ /dev/null @@ -1,71 +0,0 @@ -{{template "base/head" .}} -
- {{template "user/settings/navbar" .}} -
- {{template "base/alert" .}} -

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

-
-
-
- {{.i18n.Tr "settings.openid_desc"}} -
- {{range .OpenIDs}} -
-
- -
-
-
- {{$.CsrfTokenHtml}} - - {{if .Show}} - - {{else}} - - {{end}} - -
-
-
- {{.URI}} -
-
- {{end}} -
-
-
-
- {{.CsrfTokenHtml}} -
- - -
- -
-
-
-
- - -{{template "base/footer" .}} diff --git a/templates/user/settings/organization.tmpl b/templates/user/settings/organization.tmpl index 2d357cb3b5..de541dcd17 100644 --- a/templates/user/settings/organization.tmpl +++ b/templates/user/settings/organization.tmpl @@ -1,5 +1,5 @@ {{template "base/head" .}} -
diff --git a/templates/user/settings/repos.tmpl b/templates/user/settings/repos.tmpl index 39d98c6d1e..efb2c41c5b 100644 --- a/templates/user/settings/repos.tmpl +++ b/templates/user/settings/repos.tmpl @@ -1,5 +1,5 @@ {{template "base/head" .}} -
+
{{template "user/settings/navbar" .}}
{{template "base/alert" .}} diff --git a/templates/user/settings/security.tmpl b/templates/user/settings/security.tmpl index b7cd222b30..8e7044f7df 100644 --- a/templates/user/settings/security.tmpl +++ b/templates/user/settings/security.tmpl @@ -1,79 +1,14 @@ {{template "base/head" .}} -
+
{{template "user/settings/navbar" .}}
{{template "base/alert" .}} -

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

-
- {{if or (.SignedUser.IsLocal) (.SignedUser.IsOAuth2)}} -
- {{.CsrfTokenHtml}} - {{if .SignedUser.IsPasswordSet}} -
- - -
- {{end}} -
- - -
-
- - -
- -
- - {{.i18n.Tr "auth.forgot_password"}} -
-
- {{else}} -
-

{{$.i18n.Tr "settings.password_change_disabled"}}

-
- {{end}} -
-
- -

- {{.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/security_accountlinks.tmpl b/templates/user/settings/security_accountlinks.tmpl new file mode 100644 index 0000000000..93cc508a54 --- /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.IsActived}}{{$.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..12f4aab419 --- /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_twofa.tmpl b/templates/user/settings/security_twofa.tmpl new file mode 100644 index 0000000000..05112a21bb --- /dev/null +++ b/templates/user/settings/security_twofa.tmpl @@ -0,0 +1,35 @@ +

+ {{.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}} +
+ + diff --git a/templates/user/settings/twofa.tmpl b/templates/user/settings/twofa.tmpl deleted file mode 100644 index c6a7a7cba0..0000000000 --- a/templates/user/settings/twofa.tmpl +++ /dev/null @@ -1,44 +0,0 @@ -{{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 index 9238fb61a5..0205532ac8 100644 --- a/templates/user/settings/twofa_enroll.tmpl +++ b/templates/user/settings/twofa_enroll.tmpl @@ -1,5 +1,5 @@ {{template "base/head" .}} -
+
{{template "user/settings/navbar" .}}
{{template "base/alert" .}} -- cgit v1.2.3