You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

173 lines
6.0 KiB

  1. {{template "base/head" .}}
  2. <div class="user settings account">
  3. {{template "user/settings/navbar" .}}
  4. <div class="ui container">
  5. {{template "base/alert" .}}
  6. <h4 class="ui top attached header">
  7. {{.i18n.Tr "settings.password"}}
  8. </h4>
  9. <div class="ui attached segment">
  10. {{if or (.SignedUser.IsLocal) (.SignedUser.IsOAuth2)}}
  11. <form class="ui form" action="{{AppSubUrl}}/user/settings/account" method="post">
  12. {{.CsrfTokenHtml}}
  13. {{if .SignedUser.IsPasswordSet}}
  14. <div class="required field {{if .Err_OldPassword}}error{{end}}">
  15. <label for="old_password">{{.i18n.Tr "settings.old_password"}}</label>
  16. <input id="old_password" name="old_password" type="password" autocomplete="off" autofocus required>
  17. </div>
  18. {{end}}
  19. <div class="required field {{if .Err_Password}}error{{end}}">
  20. <label for="password">{{.i18n.Tr "settings.new_password"}}</label>
  21. <input id="password" name="password" type="password" autocomplete="off" required>
  22. </div>
  23. <div class="required field {{if .Err_Password}}error{{end}}">
  24. <label for="retype">{{.i18n.Tr "settings.retype_new_password"}}</label>
  25. <input id="retype" name="retype" type="password" autocomplete="off" required>
  26. </div>
  27. <div class="field">
  28. <button class="ui green button">{{$.i18n.Tr "settings.change_password"}}</button>
  29. <a href="{{AppSubUrl}}/user/forgot_password?email={{.Email}}">{{.i18n.Tr "auth.forgot_password"}}</a>
  30. </div>
  31. </form>
  32. {{else}}
  33. <div class="ui info message">
  34. <p class="text left">{{$.i18n.Tr "settings.password_change_disabled"}}</p>
  35. </div>
  36. {{end}}
  37. </div>
  38. <h4 class="ui top attached header">
  39. {{.i18n.Tr "settings.manage_emails"}}
  40. </h4>
  41. <div class="ui attached segment">
  42. <div class="ui email list">
  43. <div class="item">
  44. {{.i18n.Tr "settings.email_desc"}}
  45. </div>
  46. {{range .Emails}}
  47. <div class="item">
  48. {{if not .IsPrimary}}
  49. <div class="right floated content">
  50. <button class="ui red tiny button delete-button" id="delete-email" data-url="{{AppSubUrl}}/user/settings/account/email/delete" data-id="{{.ID}}">
  51. {{$.i18n.Tr "settings.delete_email"}}
  52. </button>
  53. </div>
  54. {{if .IsActivated}}
  55. <div class="right floated content">
  56. <form action="{{AppSubUrl}}/user/settings/account/email" method="post">
  57. {{$.CsrfTokenHtml}}
  58. <input name="_method" type="hidden" value="PRIMARY">
  59. <input name="id" type="hidden" value="{{.ID}}">
  60. <button class="ui blue tiny button">{{$.i18n.Tr "settings.primary_email"}}</button>
  61. </form>
  62. </div>
  63. {{end}}
  64. {{end}}
  65. <div class="content">
  66. <strong>{{.Email}}</strong>
  67. {{if .IsPrimary}}<span class="text red">{{$.i18n.Tr "settings.primary"}}</span>{{end}}
  68. </div>
  69. </div>
  70. {{end}}
  71. </div>
  72. </div>
  73. <div class="ui attached bottom segment">
  74. <form class="ui form" action="{{AppSubUrl}}/user/settings/account/email" method="post">
  75. {{.CsrfTokenHtml}}
  76. <div class="required field {{if .Err_Email}}error{{end}}">
  77. <label for="email">{{.i18n.Tr "settings.add_new_email"}}</label>
  78. <input id="email" name="email" type="email" required>
  79. </div>
  80. <button class="ui green button">
  81. {{.i18n.Tr "settings.add_email"}}
  82. </button>
  83. </form>
  84. </div>
  85. <h4 class="ui top attached header">
  86. {{.i18n.Tr "settings.manage_themes"}}
  87. </h4>
  88. <div class="ui attached segment">
  89. <div class="ui email list">
  90. <div class="item">
  91. {{.i18n.Tr "settings.theme_desc"}}
  92. </div>
  93. <form class="ui form" action="{{.Link}}/theme" method="post">
  94. {{.CsrfTokenHtml}}
  95. <div class="field">
  96. <label for="ui">{{.i18n.Tr "settings.ui"}}</label>
  97. <div class="ui selection dropdown" id="ui">
  98. <input name="theme" type="hidden" value="{{.SignedUser.Theme}}">
  99. <i class="dropdown icon"></i>
  100. <div class="text">
  101. {{range $i,$a := .AllThemes}}
  102. {{if eq $.SignedUser.Theme $a}}{{$a}}{{end}}
  103. {{end}}
  104. </div>
  105. <div class="menu">
  106. {{range $i,$a := .AllThemes}}
  107. <div class="item{{if eq $.SignedUser.Theme $a}} active selected{{end}}" data-value="{{$a}}">
  108. {{$a}}
  109. </div>
  110. {{end}}
  111. </div>
  112. </div>
  113. </div>
  114. <div class="field">
  115. <button class="ui green button">{{$.i18n.Tr "settings.update_theme"}}</button>
  116. </div>
  117. </form>
  118. </div>
  119. </div>
  120. <h4 class="ui top attached warning header">
  121. {{.i18n.Tr "settings.delete_account"}}
  122. </h4>
  123. <div class="ui attached warning segment">
  124. <div class="ui red message">
  125. <p class="text left"><i class="octicon octicon-alert"></i> {{.i18n.Tr "settings.delete_prompt" | Str2html}}</p>
  126. </div>
  127. <form class="ui form ignore-dirty" id="delete-form" action="{{AppSubUrl}}/user/settings/account/delete" method="post">
  128. {{.CsrfTokenHtml}}
  129. <input class="fake" type="password">
  130. <div class="required field {{if .Err_Password}}error{{end}}">
  131. <label for="password-confirmation">{{.i18n.Tr "password"}}</label>
  132. <input id="password-confirmation" name="password" type="password" required>
  133. </div>
  134. <div class="field">
  135. <div class="ui red button delete-button" id="delete-account" data-type="form" data-form="#delete-form">
  136. {{.i18n.Tr "settings.confirm_delete_account"}}
  137. </div>
  138. <a href="{{AppSubUrl}}/user/forgot_password?email={{.Email}}">{{.i18n.Tr "auth.forgot_password"}}</a>
  139. </div>
  140. </form>
  141. </div>
  142. </div>
  143. </div>
  144. <div class="ui small basic delete modal" id="delete-email">
  145. <div class="ui icon header">
  146. <i class="trash icon"></i>
  147. {{.i18n.Tr "settings.email_deletion"}}
  148. </div>
  149. <div class="content">
  150. <p>{{.i18n.Tr "settings.email_deletion_desc"}}</p>
  151. </div>
  152. {{template "base/delete_modal_actions" .}}
  153. </div>
  154. <div class="ui small basic delete modal" id="delete-account">
  155. <div class="ui icon header">
  156. <i class="trash icon"></i>
  157. {{.i18n.Tr "settings.delete_account_title"}}
  158. </div>
  159. <div class="content">
  160. <p>{{.i18n.Tr "settings.delete_account_desc"}}</p>
  161. </div>
  162. {{template "base/delete_modal_actions" .}}
  163. </div>
  164. {{template "base/footer" .}}