summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorDavid Schneiderbauer <daviian@users.noreply.github.com>2018-05-15 12:07:32 +0200
committerLauris BH <lauris@nix.lv>2018-05-15 13:07:32 +0300
commit099372d76c411c598285d637bd85c9b2dbc40948 (patch)
treebce801f16b8534e2ca0dadcbc24455de95f0501c /templates
parent1546458f7df4a4f0e77b7ae5cb65baed6feae394 (diff)
downloadgitea-099372d76c411c598285d637bd85c9b2dbc40948.tar.gz
gitea-099372d76c411c598285d637bd85c9b2dbc40948.zip
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
Diffstat (limited to 'templates')
-rw-r--r--templates/user/profile.tmpl2
-rw-r--r--templates/user/settings/account.tmpl135
-rw-r--r--templates/user/settings/account_link.tmpl44
-rw-r--r--templates/user/settings/applications.tmpl33
-rw-r--r--templates/user/settings/avatar.tmpl46
-rw-r--r--templates/user/settings/delete.tmpl41
-rw-r--r--templates/user/settings/email.tmpl66
-rw-r--r--templates/user/settings/navbar.tmpl22
-rw-r--r--templates/user/settings/openid.tmpl71
-rw-r--r--templates/user/settings/organization.tmpl2
-rw-r--r--templates/user/settings/profile.tmpl37
-rw-r--r--templates/user/settings/repos.tmpl2
-rw-r--r--templates/user/settings/security.tmpl77
-rw-r--r--templates/user/settings/security_accountlinks.tmpl36
-rw-r--r--templates/user/settings/security_openid.tmpl63
-rw-r--r--templates/user/settings/security_twofa.tmpl35
-rw-r--r--templates/user/settings/twofa.tmpl44
-rw-r--r--templates/user/settings/twofa_enroll.tmpl2
18 files changed, 337 insertions, 421 deletions
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 @@
<div class="ui five wide column">
<div class="ui card">
{{if eq .SignedUserName .Owner.Name}}
- <a class="image poping up" href="{{AppSubUrl}}/user/settings/avatar" id="profile-avatar" data-content="{{.i18n.Tr "user.change_avatar"}}" data-variation="inverted tiny" data-position="bottom center">
+ <a class="image poping up" href="{{AppSubUrl}}/user/settings" id="profile-avatar" data-content="{{.i18n.Tr "user.change_avatar"}}" data-variation="inverted tiny" data-position="bottom center">
<img src="{{.Owner.SizedRelAvatarLink 290}}" title="{{.Owner.Name}}"/>
</a>
{{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" .}}
+<div class="user settings account">
+ {{template "user/settings/navbar" .}}
+ <div class="ui container">
+ {{template "base/alert" .}}
+ <h4 class="ui top attached header">
+ {{.i18n.Tr "settings.password"}}
+ </h4>
+ <div class="ui attached segment">
+ {{if or (.SignedUser.IsLocal) (.SignedUser.IsOAuth2)}}
+ <form class="ui form" action="{{.Link}}?tp=password" method="post">
+ {{.CsrfTokenHtml}}
+ {{if .SignedUser.IsPasswordSet}}
+ <div class="required field {{if .Err_OldPassword}}error{{end}}">
+ <label for="old_password">{{.i18n.Tr "settings.old_password"}}</label>
+ <input id="old_password" name="old_password" type="password" autocomplete="off" autofocus required>
+ </div>
+ {{end}}
+ <div class="required field {{if .Err_Password}}error{{end}}">
+ <label for="password">{{.i18n.Tr "settings.new_password"}}</label>
+ <input id="password" name="password" type="password" autocomplete="off" required>
+ </div>
+ <div class="required field {{if .Err_Password}}error{{end}}">
+ <label for="retype">{{.i18n.Tr "settings.retype_new_password"}}</label>
+ <input id="retype" name="retype" type="password" autocomplete="off" required>
+ </div>
+
+ <div class="field">
+ <button class="ui green button">{{$.i18n.Tr "settings.change_password"}}</button>
+ <a href="{{AppSubUrl}}/user/forgot_password?email={{.Email}}">{{.i18n.Tr "auth.forgot_password"}}</a>
+ </div>
+ </form>
+ {{else}}
+ <div class="ui info message">
+ <p class="text left">{{$.i18n.Tr "settings.password_change_disabled"}}</p>
+ </div>
+ {{end}}
+ </div>
+
+ <h4 class="ui top attached header">
+ {{.i18n.Tr "settings.manage_emails"}}
+ </h4>
+ <div class="ui attached segment">
+ <div class="ui email list">
+ <div class="item">
+ {{.i18n.Tr "settings.email_desc"}}
+ </div>
+ {{range .Emails}}
+ <div class="item">
+ {{if not .IsPrimary}}
+ <div class="right floated content">
+ <button class="ui red tiny button delete-button" id="delete-email" data-url="{{$.Link}}/email/delete" data-id="{{.ID}}">
+ {{$.i18n.Tr "settings.delete_email"}}
+ </button>
+ </div>
+ {{if .IsActivated}}
+ <div class="right floated content">
+ <form action="{{$.Link}}/email" method="post">
+ {{$.CsrfTokenHtml}}
+ <input name="_method" type="hidden" value="PRIMARY">
+ <input name="id" type="hidden" value="{{.ID}}">
+ <button class="ui blue tiny button">{{$.i18n.Tr "settings.primary_email"}}</button>
+ </form>
+ </div>
+ {{end}}
+ {{end}}
+ <div class="content">
+ <strong>{{.Email}}</strong>
+ {{if .IsPrimary}}<span class="text red">{{$.i18n.Tr "settings.primary"}}</span>{{end}}
+ </div>
+ </div>
+ {{end}}
+ </div>
+ </div>
+ <div class="ui attached bottom segment">
+ <form class="ui form" action="{{.Link}}/email" method="post">
+ {{.CsrfTokenHtml}}
+ <div class="required field {{if .Err_Email}}error{{end}}">
+ <label for="email">{{.i18n.Tr "settings.add_new_email"}}</label>
+ <input id="email" name="email" type="email" required>
+ </div>
+ <button class="ui green button">
+ {{.i18n.Tr "settings.add_email"}}
+ </button>
+ </form>
+ </div>
+
+ <h4 class="ui top attached warning header">
+ {{.i18n.Tr "settings.delete_account"}}
+ </h4>
+ <div class="ui attached warning segment">
+ <div class="ui red message">
+ <p class="text left"><i class="octicon octicon-alert"></i> {{.i18n.Tr "settings.delete_prompt" | Str2html}}</p>
+ </div>
+ <form class="ui form ignore-dirty" id="delete-form" action="{{.Link}}/delete" method="post">
+ {{.CsrfTokenHtml}}
+ <input class="fake" type="password">
+ <div class="required field {{if .Err_Password}}error{{end}}">
+ <label for="password-confirmation">{{.i18n.Tr "password"}}</label>
+ <input id="password-confirmation" name="password" type="password" required>
+ </div>
+ <div class="field">
+ <div class="ui red button delete-button" id="delete-account" data-type="form" data-form="#delete-form">
+ {{.i18n.Tr "settings.confirm_delete_account"}}
+ </div>
+ <a href="{{AppSubUrl}}/user/forgot_password?email={{.Email}}">{{.i18n.Tr "auth.forgot_password"}}</a>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+
+<div class="ui small basic delete modal" id="delete-email">
+ <div class="ui icon header">
+ <i class="trash icon"></i>
+ {{.i18n.Tr "settings.email_deletion"}}
+ </div>
+ <div class="content">
+ <p>{{.i18n.Tr "settings.email_deletion_desc"}}</p>
+ </div>
+ {{template "base/delete_modal_actions" .}}
+</div>
+
+<div class="ui small basic delete modal" id="delete-account">
+ <div class="ui icon header">
+ <i class="trash icon"></i>
+ {{.i18n.Tr "settings.delete_account_title"}}
+ </div>
+ <div class="content">
+ <p>{{.i18n.Tr "settings.delete_account_desc"}}</p>
+ </div>
+ {{template "base/delete_modal_actions" .}}
+</div>
+
+{{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" .}}
-<div class="user settings account_link">
- {{template "user/settings/navbar" .}}
- <div class="ui container">
- {{template "base/alert" .}}
- <h4 class="ui top attached header">
- {{.i18n.Tr "settings.manage_account_links"}}
- </h4>
- <div class="ui attached segment">
- <div class="ui key list">
- <div class="item">
- {{.i18n.Tr "settings.manage_account_links_desc"}}
- </div>
- {{if .AccountLinks}}
- {{range $loginSource, $provider := .AccountLinks}}
- <div class="item">
- <div class="right floated content">
- <button class="ui red tiny button delete-button" data-url="{{$.Link}}" data-id="{{$loginSource.ID}}">
- {{$.i18n.Tr "settings.delete_key"}}
- </button>
- </div>
- <div class="content">
- <strong>{{$provider}}</strong>
- {{if $loginSource.IsActived}}<span class="text red">{{$.i18n.Tr "settings.active"}}</span>{{end}}
- </div>
- </div>
- {{end}}
- {{end}}
- </div>
- </div>
- </div>
-</div>
-
-<div class="ui small basic delete modal">
- <div class="ui icon header">
- <i class="trash icon"></i>
- {{.i18n.Tr "settings.remove_account_link"}}
- </div>
- <div class="content">
- <p>{{.i18n.Tr "settings.remove_account_link_desc"}}</p>
- </div>
- {{template "base/delete_modal_actions" .}}
-</div>
-{{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" .}}
-<div class="user settings">
+<div class="user settings applications">
{{template "user/settings/navbar" .}}
<div class="ui container">
- {{template "base/alert" .}}
<h4 class="ui top attached header">
{{.i18n.Tr "settings.manage_access_token"}}
</h4>
@@ -13,26 +12,26 @@
</div>
{{range .Tokens}}
<div class="item">
- <div class="right floated content">
- <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}">
+ <div class="right floated content">
+ <button class="ui red tiny button delete-button" id="delete-token" data-url="{{$.Link}}/delete" data-id="{{.ID}}">
{{$.i18n.Tr "settings.delete_token"}}
</button>
- </div>
- <i class="big send icon {{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.token_state_desc"}}" data-variation="inverted tiny"{{end}}></i>
- <div class="content">
- <strong>{{.Name}}</strong>
- <div class="activity meta">
- <i>{{$.i18n.Tr "settings.add_on"}} <span>{{.CreatedUnix.FormatShort}}</span> — <i class="octicon octicon-info"></i> {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{.UpdatedUnix.FormatShort}}</span>{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}</i>
- </div>
+ </div>
+ <i class="big send icon {{if .HasRecentActivity}}green{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.token_state_desc"}}" data-variation="inverted tiny"{{end}}></i>
+ <div class="content">
+ <strong>{{.Name}}</strong>
+ <div class="activity meta">
+ <i>{{$.i18n.Tr "settings.add_on"}} <span>{{.CreatedUnix.FormatShort}}</span> — <i class="octicon octicon-info"></i> {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{.UpdatedUnix.FormatShort}}</span>{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}</i>
</div>
+ </div>
</div>
{{end}}
</div>
</div>
- <h4 class="ui top attached header">
- {{.i18n.Tr "settings.generate_new_token"}}
- </h4>
- <div class="ui attached segment">
+ <div class="ui attached bottom segment">
+ <h5 class="ui top header">
+ {{.i18n.Tr "settings.generate_new_token"}}
+ </h5>
<p>{{.i18n.Tr "settings.new_token_desc"}}</p>
<form class="ui form ignore-dirty" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
@@ -48,7 +47,7 @@
</div>
</div>
-<div class="ui small basic delete modal">
+<div class="ui small basic delete modal" id="delete-token">
<div class="ui icon header">
<i class="trash icon"></i>
{{.i18n.Tr "settings.access_token_deletion"}}
@@ -67,4 +66,6 @@
</div>
</div>
</div>
+
+
{{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" .}}
-<div class="user settings avatar">
- {{template "user/settings/navbar" .}}
- <div class="ui container">
- {{template "base/alert" .}}
- <h4 class="ui top attached header">
- {{.i18n.Tr "settings.avatar"}}
- </h4>
- <div class="ui attached segment">
-
- <form class="ui form" action="{{.Link}}" method="post" enctype="multipart/form-data">
- {{.CsrfTokenHtml}}
- {{if not DisableGravatar}}
- <div class="inline field">
- <div class="ui radio checkbox">
- <input name="source" value="lookup" type="radio" {{if not .SignedUser.UseCustomAvatar}}checked{{end}}>
- <label>{{.i18n.Tr "settings.lookup_avatar_by_mail"}}</label>
- </div>
- </div>
- <div class="field {{if .Err_Gravatar}}error{{end}}">
- <label for="gravatar">Avatar {{.i18n.Tr "email"}}</label>
- <input id="gravatar" name="gravatar" value="{{.SignedUser.AvatarEmail}}" />
- </div>
- {{end}}
-
- <div class="inline field">
- <div class="ui radio checkbox">
- <input name="source" value="local" type="radio" {{if .SignedUser.UseCustomAvatar}}checked{{end}}>
- <label>{{.i18n.Tr "settings.enable_custom_avatar"}}</label>
- </div>
- </div>
-
- <div class="inline field">
- <label for="avatar">{{.i18n.Tr "settings.choose_new_avatar"}}</label>
- <input name="avatar" type="file" >
- </div>
-
- <div class="field">
- <button class="ui green button">{{$.i18n.Tr "settings.update_avatar"}}</button>
- <a class="ui red button delete-post" data-request-url="{{.Link}}/delete" data-done-url="{{.Link}}">{{$.i18n.Tr "settings.delete_current_avatar"}}</a>
- </div>
- </form>
- </div>
- </div>
-</div>
-{{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" .}}
-<div class="user settings delete">
- {{template "user/settings/navbar" .}}
- <div class="ui container">
- {{template "base/alert" .}}
- <h4 class="ui top attached warning header">
- {{.i18n.Tr "settings.delete_account"}}
- </h4>
- <div class="ui attached warning segment">
- <div class="ui red message">
- <p class="text left"><i class="octicon octicon-alert"></i> {{.i18n.Tr "settings.delete_prompt" | Str2html}}</p>
- </div>
- <form class="ui form ignore-dirty" id="delete-form" action="{{.Link}}" method="post">
- {{.CsrfTokenHtml}}
- <input class="fake" type="password">
- <div class="required field {{if .Err_Password}}error{{end}}">
- <label for="password">{{.i18n.Tr "password"}}</label>
- <input id="password" name="password" type="password" autofocus required>
- </div>
- <div class="field">
- <div class="ui red button delete-button" data-type="form" data-form="#delete-form">
- {{.i18n.Tr "settings.confirm_delete_account"}}
- </div>
- <a href="{{AppSubUrl}}/user/forgot_password?email={{.Email}}">{{.i18n.Tr "auth.forgot_password"}}</a>
- </div>
- </form>
- </div>
- </div>
-</div>
-
-<div class="ui small basic delete modal">
- <div class="ui icon header">
- <i class="trash icon"></i>
- {{.i18n.Tr "settings.delete_account_title"}}
- </div>
- <div class="content">
- <p>{{.i18n.Tr "settings.delete_account_desc"}}</p>
- </div>
- {{template "base/delete_modal_actions" .}}
-</div>
-{{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" .}}
-<div class="user settings emails">
- {{template "user/settings/navbar" .}}
- <div class="ui container">
- {{template "base/alert" .}}
- <h4 class="ui top attached header">
- {{.i18n.Tr "settings.manage_emails"}}
- </h4>
- <div class="ui attached segment">
- <div class="ui email list">
- <div class="item">
- {{.i18n.Tr "settings.email_desc"}}
- </div>
- {{range .Emails}}
- <div class="item">
- {{if not .IsPrimary}}
- <div class="right floated content">
- <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}">
- {{$.i18n.Tr "settings.delete_email"}}
- </button>
- </div>
- {{if .IsActivated}}
- <div class="right floated content">
- <form action="{{$.Link}}" method="post">
- {{$.CsrfTokenHtml}}
- <input name="_method" type="hidden" value="PRIMARY">
- <input name="id" type="hidden" value="{{.ID}}">
- <button class="ui blue tiny button">{{$.i18n.Tr "settings.primary_email"}}</button>
- </form>
- </div>
- {{end}}
- {{end}}
- <div class="content">
- <strong>{{.Email}}</strong>
- {{if .IsPrimary}}<span class="text red">{{$.i18n.Tr "settings.primary"}}</span>{{end}}
- </div>
- </div>
- {{end}}
- </div>
- </div>
- <div class="ui attached bottom segment">
- <form class="ui form" action="{{.Link}}" method="post">
- {{.CsrfTokenHtml}}
- <div class="required field {{if .Err_Email}}error{{end}}">
- <label for="email">{{.i18n.Tr "settings.add_new_email"}}</label>
- <input id="email" name="email" type="email" autofocus required>
- </div>
- <button class="ui green button">
- {{.i18n.Tr "settings.add_email"}}
- </button>
- </form>
- </div>
- </div>
-</div>
-
-<div class="ui small basic delete modal">
- <div class="ui icon header">
- <i class="trash icon"></i>
- {{.i18n.Tr "settings.email_deletion"}}
- </div>
- <div class="content">
- <p>{{.i18n.Tr "settings.email_deletion_desc"}}</p>
- </div>
- {{template "base/delete_modal_actions" .}}
-</div>
-{{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 @@
<a class="{{if .PageIsSettingsProfile}}active{{end}} item" href="{{AppSubUrl}}/user/settings">
{{.i18n.Tr "settings.profile"}}
</a>
- <a class="{{if .PageIsSettingsAvatar}}active{{end}} item" href="{{AppSubUrl}}/user/settings/avatar">
- {{.i18n.Tr "settings.avatar"}}
+ <a class="{{if .PageIsSettingsAccount}}active{{end}} item" href="{{AppSubUrl}}/user/settings/account">
+ {{.i18n.Tr "settings.account"}}
</a>
<a class="{{if .PageIsSettingsSecurity}}active{{end}} item" href="{{AppSubUrl}}/user/settings/security">
{{.i18n.Tr "settings.security"}}
</a>
- <a class="{{if .PageIsSettingsEmails}}active{{end}} item" href="{{AppSubUrl}}/user/settings/email">
- {{.i18n.Tr "settings.emails"}}
- </a>
- {{if .EnableOpenIDSignIn}}
- <a class="{{if .PageIsSettingsOpenID}}active{{end}} item" href="{{AppSubUrl}}/user/settings/openid">
- OpenID
- </a>
- {{end}}
- <a class="{{if .PageIsSettingsKeys}}active{{end}} item" href="{{AppSubUrl}}/user/settings/keys">
- {{.i18n.Tr "settings.ssh_gpg_keys"}}
- </a>
<a class="{{if .PageIsSettingsApplications}}active{{end}} item" href="{{AppSubUrl}}/user/settings/applications">
{{.i18n.Tr "settings.applications"}}
</a>
- <a class="{{if .PageIsSettingsAccountLink}}active{{end}} item" href="{{AppSubUrl}}/user/settings/account_link">
- {{.i18n.Tr "settings.account_link"}}
+ <a class="{{if .PageIsSettingsKeys}}active{{end}} item" href="{{AppSubUrl}}/user/settings/keys">
+ {{.i18n.Tr "settings.ssh_gpg_keys"}}
</a>
<a class="{{if .PageIsSettingsOrganization}}active{{end}} item" href="{{AppSubUrl}}/user/settings/organization">
{{.i18n.Tr "settings.organization"}}
@@ -31,7 +20,4 @@
<a class="{{if .PageIsSettingsRepos}}active{{end}} item" href="{{AppSubUrl}}/user/settings/repos">
{{.i18n.Tr "settings.repos"}}
</a>
- <a class="{{if .PageIsSettingsDelete}}active{{end}} item" href="{{AppSubUrl}}/user/settings/delete">
- {{.i18n.Tr "settings.delete"}}
- </a>
</div>
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" .}}
-<div class="user settings openid">
- {{template "user/settings/navbar" .}}
- <div class="ui container">
- {{template "base/alert" .}}
- <h4 class="ui top attached header">
- {{.i18n.Tr "settings.manage_openid"}}
- </h4>
- <div class="ui attached segment">
- <div class="ui openid list">
- <div class="item">
- {{.i18n.Tr "settings.openid_desc"}}
- </div>
- {{range .OpenIDs}}
- <div class="item">
- <div class="right floated content">
- <button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}">
- {{$.i18n.Tr "settings.delete_key"}}
- </button>
- </div>
- <div class="right floated content">
- <form action="{{$.Link}}/toggle_visibility" method="post">
- {{$.CsrfTokenHtml}}
- <input name="id" type="hidden" value="{{.ID}}">
- {{if .Show}}
- <button class="ui tiny button">
- <i class="icon fa-eye"></i>
- {{$.i18n.Tr "settings.hide_openid"}}
- </button>
- {{else}}
- <button class="ui tiny button">
- <i class="icon fa-eye-slash"></i>
- {{$.i18n.Tr "settings.show_openid"}}
- </button>
- {{end}}
- </button>
- </form>
- </div>
- <div class="content">
- <strong>{{.URI}}</strong>
- </div>
- </div>
- {{end}}
- </div>
- </div>
- <div class="ui attached bottom segment">
- <form class="ui form" action="{{.Link}}" method="post">
- {{.CsrfTokenHtml}}
- <div class="required field {{if .Err_OpenID}}error{{end}}">
- <label for="openid">{{.i18n.Tr "settings.add_new_openid"}}</label>
- <input id="openid" name="openid" type="text" autofocus required>
- </div>
- <button class="ui green button">
- {{.i18n.Tr "settings.add_openid"}}
- </button>
- </form>
- </div>
- </div>
-</div>
-
-<div class="ui small basic delete modal">
- <div class="ui icon header">
- <i class="trash icon"></i>
- {{.i18n.Tr "settings.openid_deletion"}}
- </div>
- <div class="content">
- <p>{{.i18n.Tr "settings.openid_deletion_desc"}}</p>
- </div>
- {{template "base/delete_modal_actions" .}}
-</div>
-{{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" .}}
-<div class="user settings account_link">
+<div class="user settings organization">
{{template "user/settings/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
diff --git a/templates/user/settings/profile.tmpl b/templates/user/settings/profile.tmpl
index 4e6930e0f5..e5bb2df011 100644
--- a/templates/user/settings/profile.tmpl
+++ b/templates/user/settings/profile.tmpl
@@ -58,7 +58,44 @@
<button class="ui green button">{{$.i18n.Tr "settings.update_profile"}}</button>
</div>
</form>
+ </div>
+
+ <h4 class="ui top attached header">
+ {{.i18n.Tr "settings.avatar"}}
+ </h4>
+ <div class="ui attached segment">
+ <form class="ui form" action="{{.Link}}/avatar" method="post" enctype="multipart/form-data">
+ {{.CsrfTokenHtml}}
+ {{if not DisableGravatar}}
+ <div class="inline field">
+ <div class="ui radio checkbox">
+ <input name="source" value="lookup" type="radio" {{if not .SignedUser.UseCustomAvatar}}checked{{end}}>
+ <label>{{.i18n.Tr "settings.lookup_avatar_by_mail"}}</label>
+ </div>
+ </div>
+ <div class="field {{if .Err_Gravatar}}error{{end}}">
+ <label for="gravatar">Avatar {{.i18n.Tr "email"}}</label>
+ <input id="gravatar" name="gravatar" value="{{.SignedUser.AvatarEmail}}" />
+ </div>
+ {{end}}
+ <div class="inline field">
+ <div class="ui radio checkbox">
+ <input name="source" value="local" type="radio" {{if .SignedUser.UseCustomAvatar}}checked{{end}}>
+ <label>{{.i18n.Tr "settings.enable_custom_avatar"}}</label>
+ </div>
+ </div>
+
+ <div class="inline field">
+ <label for="avatar">{{.i18n.Tr "settings.choose_new_avatar"}}</label>
+ <input name="avatar" type="file" >
+ </div>
+
+ <div class="field">
+ <button class="ui green button">{{$.i18n.Tr "settings.update_avatar"}}</button>
+ <a class="ui red button delete-post" data-request-url="{{.Link}}/avatar/delete" data-done-url="{{.Link}}">{{$.i18n.Tr "settings.delete_current_avatar"}}</a>
+ </div>
+ </form>
</div>
</div>
</div>
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" .}}
-<div class="user settings">
+<div class="user settings repos">
{{template "user/settings/navbar" .}}
<div class="ui container">
{{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" .}}
-<div class="user settings password">
+<div class="user settings security">
{{template "user/settings/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
- <h4 class="ui top attached header">
- {{.i18n.Tr "settings.password"}}
- </h4>
- <div class="ui attached segment">
- {{if or (.SignedUser.IsLocal) (.SignedUser.IsOAuth2)}}
- <form class="ui form" action="{{.Link}}?tp=password" method="post">
- {{.CsrfTokenHtml}}
- {{if .SignedUser.IsPasswordSet}}
- <div class="required field {{if .Err_OldPassword}}error{{end}}">
- <label for="old_password">{{.i18n.Tr "settings.old_password"}}</label>
- <input id="old_password" name="old_password" type="password" autocomplete="off" autofocus required>
- </div>
- {{end}}
- <div class="required field {{if .Err_Password}}error{{end}}">
- <label for="password">{{.i18n.Tr "settings.new_password"}}</label>
- <input id="password" name="password" type="password" autocomplete="off" required>
- </div>
- <div class="required field {{if .Err_Password}}error{{end}}">
- <label for="retype">{{.i18n.Tr "settings.retype_new_password"}}</label>
- <input id="retype" name="retype" type="password" autocomplete="off" required>
- </div>
-
- <div class="field">
- <button class="ui green button">{{$.i18n.Tr "settings.change_password"}}</button>
- <a href="{{AppSubUrl}}/user/forgot_password?email={{.Email}}">{{.i18n.Tr "auth.forgot_password"}}</a>
- </div>
- </form>
- {{else}}
- <div class="ui info message">
- <p class="text left">{{$.i18n.Tr "settings.password_change_disabled"}}</p>
- </div>
- {{end}}
- </div>
- <br/>
-
- <h4 class="ui top attached header">
- {{.i18n.Tr "settings.twofa"}}
- </h4>
- <div class="ui attached segment">
- <p>{{.i18n.Tr "settings.twofa_desc"}}</p>
- {{if .TwofaEnrolled}}
- <p>{{$.i18n.Tr "settings.twofa_is_enrolled" | Str2html }}</p>
- <form class="ui form" action="{{.Link}}/two_factor/regenerate_scratch" method="post" enctype="multipart/form-data">
- {{.CsrfTokenHtml}}
- <p>{{.i18n.Tr "settings.regenerate_scratch_token_desc"}}</p>
- <button class="ui blue button">{{$.i18n.Tr "settings.twofa_scratch_token_regenerate"}}</button>
- </form>
- <form class="ui form" action="{{.Link}}/two_factor/disable" method="post" enctype="multipart/form-data" id="disable-form">
- {{.CsrfTokenHtml}}
- <p>{{.i18n.Tr "settings.twofa_disable_note"}}</p>
- <div class="ui red button delete-button" data-type="form" data-form="#disable-form">{{$.i18n.Tr "settings.twofa_disable"}}</div>
- </form>
- {{else}}
- <p>{{.i18n.Tr "settings.twofa_not_enrolled"}}</p>
- <div class="inline field">
- <a class="ui green button" href="{{.Link}}/two_factor/enroll">{{$.i18n.Tr "settings.twofa_enroll"}}</a>
- </div>
- {{end}}
- </div>
- </div>
-</div>
-
-<div class="ui small basic delete modal">
- <div class="ui icon header">
- <i class="trash icon"></i>
- {{.i18n.Tr "settings.twofa_disable"}}
- </div>
- <div class="content">
- <p>{{.i18n.Tr "settings.twofa_disable_desc"}}</p>
+ {{template "user/settings/security_twofa" .}}
+ {{template "user/settings/security_accountlinks" .}}
+ {{if .EnableOpenIDSignIn}}
+ {{template "user/settings/security_openid" .}}
+ {{end}}
</div>
- {{template "base/delete_modal_actions" .}}
</div>
{{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 @@
+<h4 class="ui top attached header">
+ {{.i18n.Tr "settings.manage_account_links"}}
+</h4>
+<div class="ui attached segment">
+ <div class="ui key list">
+ <div class="item">
+ {{.i18n.Tr "settings.manage_account_links_desc"}}
+ </div>
+ {{if .AccountLinks}}
+ {{range $loginSource, $provider := .AccountLinks}}
+ <div class="item">
+ <div class="right floated content">
+ <button class="ui red tiny button delete-button" id="delete-account-link" data-url="{{$.Link}}/account_link" data-id="{{$loginSource.ID}}">
+ {{$.i18n.Tr "settings.delete_key"}}
+ </button>
+ </div>
+ <div class="content">
+ <strong>{{$provider}}</strong>
+ {{if $loginSource.IsActived}}<span class="text red">{{$.i18n.Tr "settings.active"}}</span>{{end}}
+ </div>
+ </div>
+ {{end}}
+ {{end}}
+ </div>
+</div>
+
+<div class="ui small basic delete modal" id="delete-account-link">
+ <div class="ui icon header">
+ <i class="trash icon"></i>
+ {{.i18n.Tr "settings.remove_account_link"}}
+ </div>
+ <div class="content">
+ <p>{{.i18n.Tr "settings.remove_account_link_desc"}}</p>
+ </div>
+ {{template "base/delete_modal_actions" .}}
+</div>
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 @@
+<h4 class="ui top attached header">
+ {{.i18n.Tr "settings.manage_openid"}}
+</h4>
+<div class="ui attached segment">
+ <div class="ui openid list">
+ <div class="item">
+ {{.i18n.Tr "settings.openid_desc"}}
+ </div>
+ {{range .OpenIDs}}
+ <div class="item">
+ <div class="right floated content">
+ <button class="ui red tiny button delete-button" id="delete-openid" data-url="{{$.Link}}/openid/delete" data-id="{{.ID}}">
+ {{$.i18n.Tr "settings.delete_key"}}
+ </button>
+ </div>
+ <div class="right floated content">
+ <form action="{{$.Link}}/openid/toggle_visibility" method="post">
+ {{$.CsrfTokenHtml}}
+ <input name="id" type="hidden" value="{{.ID}}">
+ {{if .Show}}
+ <button class="ui tiny button">
+ <i class="icon fa-eye"></i>
+ {{$.i18n.Tr "settings.hide_openid"}}
+ </button>
+ {{else}}
+ <button class="ui tiny button">
+ <i class="icon fa-eye-slash"></i>
+ {{$.i18n.Tr "settings.show_openid"}}
+ </button>
+ {{end}}
+ </button>
+ </form>
+ </div>
+ <div class="content">
+ <strong>{{.URI}}</strong>
+ </div>
+ </div>
+ {{end}}
+ </div>
+</div>
+<div class="ui attached bottom segment">
+ <form class="ui form" action="{{.Link}}/openid" method="post">
+ {{.CsrfTokenHtml}}
+ <div class="required field {{if .Err_OpenID}}error{{end}}">
+ <label for="openid">{{.i18n.Tr "settings.add_new_openid"}}</label>
+ <input id="openid" name="openid" type="text" autofocus required>
+ </div>
+ <button class="ui green button">
+ {{.i18n.Tr "settings.add_openid"}}
+ </button>
+ </form>
+</div>
+
+<div class="ui small basic delete modal" id="delete-openid">
+ <div class="ui icon header">
+ <i class="trash icon"></i>
+ {{.i18n.Tr "settings.openid_deletion"}}
+ </div>
+ <div class="content">
+ <p>{{.i18n.Tr "settings.openid_deletion_desc"}}</p>
+ </div>
+ {{template "base/delete_modal_actions" .}}
+</div>
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 @@
+<h4 class="ui top attached header">
+ {{.i18n.Tr "settings.twofa"}}
+</h4>
+<div class="ui attached segment">
+ <p>{{.i18n.Tr "settings.twofa_desc"}}</p>
+ {{if .TwofaEnrolled}}
+ <p>{{$.i18n.Tr "settings.twofa_is_enrolled" | Str2html }}</p>
+ <form class="ui form" action="{{.Link}}/two_factor/regenerate_scratch" method="post" enctype="multipart/form-data">
+ {{.CsrfTokenHtml}}
+ <p>{{.i18n.Tr "settings.regenerate_scratch_token_desc"}}</p>
+ <button class="ui blue button">{{$.i18n.Tr "settings.twofa_scratch_token_regenerate"}}</button>
+ </form>
+ <form class="ui form" action="{{.Link}}/two_factor/disable" method="post" enctype="multipart/form-data" id="disable-form">
+ {{.CsrfTokenHtml}}
+ <p>{{.i18n.Tr "settings.twofa_disable_note"}}</p>
+ <div class="ui red button delete-button" id="disable-twofa" data-type="form" data-form="#disable-form">{{$.i18n.Tr "settings.twofa_disable"}}</div>
+ </form>
+ {{else}}
+ <p>{{.i18n.Tr "settings.twofa_not_enrolled"}}</p>
+ <div class="inline field">
+ <a class="ui green button" href="{{.Link}}/two_factor/enroll">{{$.i18n.Tr "settings.twofa_enroll"}}</a>
+ </div>
+ {{end}}
+</div>
+
+<div class="ui small basic delete modal" id="disable-twofa">
+ <div class="ui icon header">
+ <i class="trash icon"></i>
+ {{.i18n.Tr "settings.twofa_disable"}}
+ </div>
+ <div class="content">
+ <p>{{.i18n.Tr "settings.twofa_disable_desc"}}</p>
+ </div>
+ {{template "base/delete_modal_actions" .}}
+</div>
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" .}}
-<div class="user settings delete">
- {{template "user/settings/navbar" .}}
- <div class="ui container">
- {{template "base/alert" .}}
- <h4 class="ui top attached header">
- {{.i18n.Tr "settings.twofa"}}
- </h4>
- <div class="ui attached segment">
- <p>{{.i18n.Tr "settings.twofa_desc"}}</p>
- {{if .TwofaEnrolled}}
- <p>{{$.i18n.Tr "settings.twofa_is_enrolled" | Str2html }}</p>
- <form class="ui form" action="{{.Link}}/regenerate_scratch" method="post" enctype="multipart/form-data">
- {{.CsrfTokenHtml}}
- <p>{{.i18n.Tr "settings.regenerate_scratch_token_desc"}}</p>
- <button class="ui blue button">{{$.i18n.Tr "settings.twofa_scratch_token_regenerate"}}</button>
- </form>
- <form class="ui form" action="{{.Link}}/disable" method="post" enctype="multipart/form-data" id="disable-form">
- {{.CsrfTokenHtml}}
- <p>{{.i18n.Tr "settings.twofa_disable_note"}}</p>
- <div class="ui red button delete-button" data-type="form" data-form="#disable-form">{{$.i18n.Tr "settings.twofa_disable"}}</div>
- </form>
- {{else}}
- <p>{{.i18n.Tr "settings.twofa_not_enrolled"}}</p>
- <div class="inline field">
- <a class="ui green button" href="{{.Link}}/enroll">{{$.i18n.Tr "settings.twofa_enroll"}}</a>
- </div>
- {{end}}
- </div>
- </div>
-</div>
-
-<div class="ui small basic delete modal">
- <div class="ui icon header">
- <i class="trash icon"></i>
- {{.i18n.Tr "settings.twofa_disable"}}
- </div>
- <div class="content">
- <p>{{.i18n.Tr "settings.twofa_disable_desc"}}</p>
- </div>
- {{template "base/delete_modal_actions" .}}
-</div>
-
-{{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" .}}
-<div class="user settings delete">
+<div class="user settings twofa">
{{template "user/settings/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}