|
1 | 1 | {{template "base/head" .}}
|
2 | 2 | <div role="main" aria-label="{{.Title}}" class="page-content user settings account">
|
3 |
| - {{template "user/settings/navbar" .}} |
4 | 3 | <div class="ui container">
|
5 |
| - {{template "base/alert" .}} |
6 |
| - <h4 class="ui top attached header"> |
7 |
| - {{.locale.Tr "settings.password"}} |
8 |
| - </h4> |
9 |
| - <div class="ui attached segment"> |
10 |
| - {{if or (.SignedUser.IsLocal) (.SignedUser.IsOAuth2)}} |
11 |
| - <form class="ui form ignore-dirty" action="{{AppSubUrl}}/user/settings/account" method="post"> |
12 |
| - {{template "base/disable_form_autofill"}} |
13 |
| - {{.CsrfTokenHtml}} |
14 |
| - {{if .SignedUser.IsPasswordSet}} |
15 |
| - <div class="required field {{if .Err_OldPassword}}error{{end}}"> |
16 |
| - <label for="old_password">{{.locale.Tr "settings.old_password"}}</label> |
17 |
| - <input id="old_password" name="old_password" type="password" autocomplete="current-password" autofocus required> |
18 |
| - </div> |
19 |
| - {{end}} |
20 |
| - <div class="required field {{if .Err_Password}}error{{end}}"> |
21 |
| - <label for="password">{{.locale.Tr "settings.new_password"}}</label> |
22 |
| - <input id="password" name="password" type="password" autocomplete="new-password" required> |
23 |
| - </div> |
24 |
| - <div class="required field {{if .Err_Password}}error{{end}}"> |
25 |
| - <label for="retype">{{.locale.Tr "settings.retype_new_password"}}</label> |
26 |
| - <input id="retype" name="retype" type="password" autocomplete="new-password" required> |
27 |
| - </div> |
| 4 | + <div class="ui grid"> |
| 5 | + {{template "user/settings/navbar" .}} |
| 6 | + <div class="twelve wide column content"> |
| 7 | + {{template "base/alert" .}} |
| 8 | + <h4 class="ui top attached header"> |
| 9 | + {{.locale.Tr "settings.password"}} |
| 10 | + </h4> |
| 11 | + <div class="ui attached segment"> |
| 12 | + {{if or (.SignedUser.IsLocal) (.SignedUser.IsOAuth2)}} |
| 13 | + <form class="ui form ignore-dirty" action="{{AppSubUrl}}/user/settings/account" method="post"> |
| 14 | + {{template "base/disable_form_autofill"}} |
| 15 | + {{.CsrfTokenHtml}} |
| 16 | + {{if .SignedUser.IsPasswordSet}} |
| 17 | + <div class="required field {{if .Err_OldPassword}}error{{end}}"> |
| 18 | + <label for="old_password">{{.locale.Tr "settings.old_password"}}</label> |
| 19 | + <input id="old_password" name="old_password" type="password" autocomplete="current-password" autofocus required> |
| 20 | + </div> |
| 21 | + {{end}} |
| 22 | + <div class="required field {{if .Err_Password}}error{{end}}"> |
| 23 | + <label for="password">{{.locale.Tr "settings.new_password"}}</label> |
| 24 | + <input id="password" name="password" type="password" autocomplete="new-password" required> |
| 25 | + </div> |
| 26 | + <div class="required field {{if .Err_Password}}error{{end}}"> |
| 27 | + <label for="retype">{{.locale.Tr "settings.retype_new_password"}}</label> |
| 28 | + <input id="retype" name="retype" type="password" autocomplete="new-password" required> |
| 29 | + </div> |
28 | 30 |
|
29 |
| - <div class="field"> |
30 |
| - <button class="ui green button">{{$.locale.Tr "settings.change_password"}}</button> |
31 |
| - <a href="{{AppSubUrl}}/user/forgot_password?email={{.Email}}">{{.locale.Tr "auth.forgot_password"}}</a> |
| 31 | + <div class="field"> |
| 32 | + <button class="ui green button">{{$.locale.Tr "settings.change_password"}}</button> |
| 33 | + <a href="{{AppSubUrl}}/user/forgot_password?email={{.Email}}">{{.locale.Tr "auth.forgot_password"}}</a> |
| 34 | + </div> |
| 35 | + </form> |
| 36 | + {{else}} |
| 37 | + <div class="ui info message"> |
| 38 | + <p class="text left">{{$.locale.Tr "settings.password_change_disabled"}}</p> |
| 39 | + </div> |
| 40 | + {{end}} |
32 | 41 | </div>
|
33 |
| - </form> |
34 |
| - {{else}} |
35 |
| - <div class="ui info message"> |
36 |
| - <p class="text left">{{$.locale.Tr "settings.password_change_disabled"}}</p> |
37 |
| - </div> |
38 |
| - {{end}} |
39 |
| - </div> |
40 | 42 |
|
41 |
| - <h4 class="ui top attached header"> |
42 |
| - {{.locale.Tr "settings.manage_emails"}} |
43 |
| - </h4> |
44 |
| - <div class="ui attached segment"> |
45 |
| - <div class="ui email list"> |
46 |
| - {{if $.EnableNotifyMail}} |
47 |
| - <div class="item"> |
48 |
| - <form action="{{AppSubUrl}}/user/settings/account/email" class="ui form" method="post"> |
49 |
| - {{.locale.Tr "settings.email_desc"}} |
50 |
| - <div class="right floated content"> |
51 |
| - <div class="field"> |
52 |
| - <button class="ui green button">{{$.locale.Tr "settings.email_notifications.submit"}}</button> |
53 |
| - </div> |
54 |
| - </div> |
55 |
| - <div class="right floated content"> |
56 |
| - {{$.CsrfTokenHtml}} |
57 |
| - <input name="_method" type="hidden" value="NOTIFICATION"> |
58 |
| - <div class="field"> |
59 |
| - <div class="ui selection dropdown" tabindex="0"> |
60 |
| - <input name="preference" type="hidden" value="{{.EmailNotificationsPreference}}"> |
61 |
| - {{svg "octicon-triangle-down" 14 "dropdown icon"}} |
62 |
| - <div class="text"></div> |
63 |
| - <div class="menu"> |
64 |
| - <div data-value="enabled" class="{{if eq .EmailNotificationsPreference "enabled"}}active selected {{end}}item">{{$.locale.Tr "settings.email_notifications.enable"}}</div> |
65 |
| - <div data-value="andyourown" class="{{if eq .EmailNotificationsPreference "andyourown"}}active selected {{end}}item">{{$.locale.Tr "settings.email_notifications.andyourown"}}</div> |
66 |
| - <div data-value="onmention" class="{{if eq .EmailNotificationsPreference "onmention"}}active selected {{end}}item">{{$.locale.Tr "settings.email_notifications.onmention"}}</div> |
67 |
| - <div data-value="disabled" class="{{if eq .EmailNotificationsPreference "disabled"}}active selected {{end}}item">{{$.locale.Tr "settings.email_notifications.disable"}}</div> |
| 43 | + <h4 class="ui top attached header"> |
| 44 | + {{.locale.Tr "settings.manage_emails"}} |
| 45 | + </h4> |
| 46 | + <div class="ui attached segment"> |
| 47 | + <div class="ui email list"> |
| 48 | + {{if $.EnableNotifyMail}} |
| 49 | + <div class="item"> |
| 50 | + <form action="{{AppSubUrl}}/user/settings/account/email" class="ui form" method="post"> |
| 51 | + {{.locale.Tr "settings.email_desc"}} |
| 52 | + <div class="right floated content"> |
| 53 | + <div class="field"> |
| 54 | + <button class="ui green button">{{$.locale.Tr "settings.email_notifications.submit"}}</button> |
68 | 55 | </div>
|
69 | 56 | </div>
|
70 |
| - </div> |
71 |
| - </div> |
72 |
| - </form> |
73 |
| - </div> |
74 |
| - {{end}} |
75 |
| - {{range .Emails}} |
76 |
| - <div class="item"> |
77 |
| - {{if not .IsPrimary}} |
78 |
| - <div class="right floated content"> |
79 |
| - <button class="ui red tiny button delete-button" data-modal-id="delete-email" data-url="{{AppSubUrl}}/user/settings/account/email/delete" data-id="{{.ID}}"> |
80 |
| - {{$.locale.Tr "settings.delete_email"}} |
81 |
| - </button> |
82 |
| - </div> |
83 |
| - {{if .CanBePrimary}} |
84 | 57 | <div class="right floated content">
|
85 |
| - <form action="{{AppSubUrl}}/user/settings/account/email" method="post"> |
86 |
| - {{$.CsrfTokenHtml}} |
87 |
| - <input name="_method" type="hidden" value="PRIMARY"> |
88 |
| - <input name="id" type="hidden" value="{{.ID}}"> |
89 |
| - <button class="ui primary tiny button">{{$.locale.Tr "settings.primary_email"}}</button> |
90 |
| - </form> |
| 58 | + {{$.CsrfTokenHtml}} |
| 59 | + <input name="_method" type="hidden" value="NOTIFICATION"> |
| 60 | + <div class="field"> |
| 61 | + <div class="ui selection dropdown" tabindex="0"> |
| 62 | + <input name="preference" type="hidden" value="{{.EmailNotificationsPreference}}"> |
| 63 | + {{svg "octicon-triangle-down" 14 "dropdown icon"}} |
| 64 | + <div class="text"></div> |
| 65 | + <div class="menu"> |
| 66 | + <div data-value="enabled" class="{{if eq .EmailNotificationsPreference "enabled"}}active selected {{end}}item">{{$.locale.Tr "settings.email_notifications.enable"}}</div> |
| 67 | + <div data-value="andyourown" class="{{if eq .EmailNotificationsPreference "andyourown"}}active selected {{end}}item">{{$.locale.Tr "settings.email_notifications.andyourown"}}</div> |
| 68 | + <div data-value="onmention" class="{{if eq .EmailNotificationsPreference "onmention"}}active selected {{end}}item">{{$.locale.Tr "settings.email_notifications.onmention"}}</div> |
| 69 | + <div data-value="disabled" class="{{if eq .EmailNotificationsPreference "disabled"}}active selected {{end}}item">{{$.locale.Tr "settings.email_notifications.disable"}}</div> |
| 70 | + </div> |
| 71 | + </div> |
| 72 | + </div> |
91 | 73 | </div>
|
92 |
| - {{end}} |
| 74 | + </form> |
| 75 | + </div> |
93 | 76 | {{end}}
|
94 |
| - {{if not .IsActivated}} |
95 |
| - <div class="right floated content"> |
96 |
| - <form action="{{AppSubUrl}}/user/settings/account/email" method="post"> |
97 |
| - {{$.CsrfTokenHtml}} |
98 |
| - <input name="_method" type="hidden" value="SENDACTIVATION"> |
99 |
| - <input name="id" type="hidden" value="{{.ID}}"> |
100 |
| - {{if $.ActivationsPending}} |
101 |
| - <button disabled class="ui primary tiny button">{{$.locale.Tr "settings.activations_pending"}}</button> |
| 77 | + {{range .Emails}} |
| 78 | + <div class="item"> |
| 79 | + {{if not .IsPrimary}} |
| 80 | + <div class="right floated content"> |
| 81 | + <button class="ui red tiny button delete-button" data-modal-id="delete-email" data-url="{{AppSubUrl}}/user/settings/account/email/delete" data-id="{{.ID}}"> |
| 82 | + {{$.locale.Tr "settings.delete_email"}} |
| 83 | + </button> |
| 84 | + </div> |
| 85 | + {{if .CanBePrimary}} |
| 86 | + <div class="right floated content"> |
| 87 | + <form action="{{AppSubUrl}}/user/settings/account/email" method="post"> |
| 88 | + {{$.CsrfTokenHtml}} |
| 89 | + <input name="_method" type="hidden" value="PRIMARY"> |
| 90 | + <input name="id" type="hidden" value="{{.ID}}"> |
| 91 | + <button class="ui primary tiny button">{{$.locale.Tr "settings.primary_email"}}</button> |
| 92 | + </form> |
| 93 | + </div> |
| 94 | + {{end}} |
| 95 | + {{end}} |
| 96 | + {{if not .IsActivated}} |
| 97 | + <div class="right floated content"> |
| 98 | + <form action="{{AppSubUrl}}/user/settings/account/email" method="post"> |
| 99 | + {{$.CsrfTokenHtml}} |
| 100 | + <input name="_method" type="hidden" value="SENDACTIVATION"> |
| 101 | + <input name="id" type="hidden" value="{{.ID}}"> |
| 102 | + {{if $.ActivationsPending}} |
| 103 | + <button disabled class="ui primary tiny button">{{$.locale.Tr "settings.activations_pending"}}</button> |
| 104 | + {{else}} |
| 105 | + <button class="ui primary tiny button">{{$.locale.Tr "settings.activate_email"}}</button> |
| 106 | + {{end}} |
| 107 | + </form> |
| 108 | + </div> |
| 109 | + {{end}} |
| 110 | + <div class="content"> |
| 111 | + <strong>{{.Email}}</strong> |
| 112 | + {{if .IsPrimary}} |
| 113 | + <div class="ui primary label">{{$.locale.Tr "settings.primary"}}</div> |
| 114 | + {{end}} |
| 115 | + {{if .IsActivated}} |
| 116 | + <div class="ui green label">{{$.locale.Tr "settings.activated"}}</div> |
102 | 117 | {{else}}
|
103 |
| - <button class="ui primary tiny button">{{$.locale.Tr "settings.activate_email"}}</button> |
| 118 | + <div class="ui label">{{$.locale.Tr "settings.requires_activation"}}</div> |
104 | 119 | {{end}}
|
105 |
| - </form> |
| 120 | + </div> |
106 | 121 | </div>
|
107 | 122 | {{end}}
|
108 |
| - <div class="content"> |
109 |
| - <strong>{{.Email}}</strong> |
110 |
| - {{if .IsPrimary}} |
111 |
| - <div class="ui primary label">{{$.locale.Tr "settings.primary"}}</div> |
112 |
| - {{end}} |
113 |
| - {{if .IsActivated}} |
114 |
| - <div class="ui green label">{{$.locale.Tr "settings.activated"}}</div> |
115 |
| - {{else}} |
116 |
| - <div class="ui label">{{$.locale.Tr "settings.requires_activation"}}</div> |
117 |
| - {{end}} |
118 |
| - </div> |
119 | 123 | </div>
|
120 |
| - {{end}} |
121 |
| - </div> |
122 |
| - </div> |
123 |
| - <div class="ui attached bottom segment"> |
124 |
| - <form class="ui form" action="{{AppSubUrl}}/user/settings/account/email" method="post"> |
125 |
| - {{.CsrfTokenHtml}} |
126 |
| - <div class="required field {{if .Err_Email}}error{{end}}"> |
127 |
| - <label for="email">{{.locale.Tr "settings.add_new_email"}}</label> |
128 |
| - <input id="email" name="email" type="email" required {{if not .CanAddEmails}}disabled{{end}}> |
129 | 124 | </div>
|
130 |
| - <button class="ui green button" {{if not .CanAddEmails}}disabled{{end}}> |
131 |
| - {{.locale.Tr "settings.add_email"}} |
132 |
| - </button> |
133 |
| - </form> |
134 |
| - </div> |
135 |
| - |
136 |
| - <h4 class="ui top attached error header"> |
137 |
| - {{.locale.Tr "settings.delete_account"}} |
138 |
| - </h4> |
139 |
| - <div class="ui attached error segment"> |
140 |
| - <div class="ui red message"> |
141 |
| - <p class="text left">{{svg "octicon-alert"}} {{.locale.Tr "settings.delete_prompt" | Str2html}}</p> |
142 |
| - {{if .UserDeleteWithComments}} |
143 |
| - <p class="text left" style="font-weight: bold;">{{.locale.Tr "settings.delete_with_all_comments" .UserDeleteWithCommentsMaxTime | Str2html}}</p> |
144 |
| - {{end}} |
145 |
| - </div> |
146 |
| - <form class="ui form ignore-dirty" id="delete-form" action="{{AppSubUrl}}/user/settings/account/delete" method="post"> |
147 |
| - {{template "base/disable_form_autofill"}} |
148 |
| - {{.CsrfTokenHtml}} |
149 |
| - <div class="required field {{if .Err_Password}}error{{end}}"> |
150 |
| - <label for="password-confirmation">{{.locale.Tr "password"}}</label> |
151 |
| - <input id="password-confirmation" name="password" type="password" autocomplete="off" required> |
| 125 | + <div class="ui attached bottom segment"> |
| 126 | + <form class="ui form" action="{{AppSubUrl}}/user/settings/account/email" method="post"> |
| 127 | + {{.CsrfTokenHtml}} |
| 128 | + <div class="required field {{if .Err_Email}}error{{end}}"> |
| 129 | + <label for="email">{{.locale.Tr "settings.add_new_email"}}</label> |
| 130 | + <input id="email" name="email" type="email" required {{if not .CanAddEmails}}disabled{{end}}> |
| 131 | + </div> |
| 132 | + <button class="ui green button" {{if not .CanAddEmails}}disabled{{end}}> |
| 133 | + {{.locale.Tr "settings.add_email"}} |
| 134 | + </button> |
| 135 | + </form> |
152 | 136 | </div>
|
153 |
| - <div class="field"> |
154 |
| - <button class="ui red button delete-button" data-modal-id="delete-account" data-type="form" data-form="#delete-form"> |
155 |
| - {{.locale.Tr "settings.confirm_delete_account"}} |
156 |
| - </button> |
157 |
| - <a href="{{AppSubUrl}}/user/forgot_password?email={{.Email}}">{{.locale.Tr "auth.forgot_password"}}</a> |
| 137 | + |
| 138 | + <h4 class="ui top attached error header"> |
| 139 | + {{.locale.Tr "settings.delete_account"}} |
| 140 | + </h4> |
| 141 | + <div class="ui attached error segment"> |
| 142 | + <div class="ui red message"> |
| 143 | + <p class="text left">{{svg "octicon-alert"}} {{.locale.Tr "settings.delete_prompt" | Str2html}}</p> |
| 144 | + {{if .UserDeleteWithComments}} |
| 145 | + <p class="text left" style="font-weight: bold;">{{.locale.Tr "settings.delete_with_all_comments" .UserDeleteWithCommentsMaxTime | Str2html}}</p> |
| 146 | + {{end}} |
| 147 | + </div> |
| 148 | + <form class="ui form ignore-dirty" id="delete-form" action="{{AppSubUrl}}/user/settings/account/delete" method="post"> |
| 149 | + {{template "base/disable_form_autofill"}} |
| 150 | + {{.CsrfTokenHtml}} |
| 151 | + <div class="required field {{if .Err_Password}}error{{end}}"> |
| 152 | + <label for="password-confirmation">{{.locale.Tr "password"}}</label> |
| 153 | + <input id="password-confirmation" name="password" type="password" autocomplete="off" required> |
| 154 | + </div> |
| 155 | + <div class="field"> |
| 156 | + <button class="ui red button delete-button" data-modal-id="delete-account" data-type="form" data-form="#delete-form"> |
| 157 | + {{.locale.Tr "settings.confirm_delete_account"}} |
| 158 | + </button> |
| 159 | + <a href="{{AppSubUrl}}/user/forgot_password?email={{.Email}}">{{.locale.Tr "auth.forgot_password"}}</a> |
| 160 | + </div> |
| 161 | + </form> |
158 | 162 | </div>
|
159 |
| - </form> |
| 163 | + </div> |
160 | 164 | </div>
|
161 | 165 | </div>
|
162 | 166 | </div>
|
|
0 commit comments