settings.pug 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. extends ../layout
  2. block content
  3. .content.content-alt
  4. .container
  5. .row
  6. .col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
  7. .card
  8. .page-header
  9. h1 #{translate("account_settings")}
  10. .account-settings(ng-controller="AccountSettingsController", ng-cloak)
  11. form-messages(for="settingsForm")
  12. .alert.alert-success(ng-show="settingsForm.response.success")
  13. | #{translate("thanks_settings_updated")}
  14. form-messages(for="changePasswordForm")
  15. .container-fluid
  16. .row
  17. .col-md-5
  18. h3 #{translate("update_account_info")}
  19. form(async-form="settings", name="settingsForm", method="POST", action="/user/settings", novalidate)
  20. input(type="hidden", name="_csrf", value=csrfToken)
  21. if !externalAuthenticationSystemUsed()
  22. .form-group
  23. label(for='email') #{translate("email")}
  24. input.form-control(
  25. type='email',
  26. name='email',
  27. placeholder="email@example.com"
  28. required,
  29. ng-model="email",
  30. ng-init="email = "+JSON.stringify(user.email),
  31. ng-model-options="{ updateOn: 'blur' }"
  32. )
  33. span.small.text-primary(ng-show="settingsForm.email.$invalid && settingsForm.email.$dirty")
  34. | #{translate("must_be_email_address")}
  35. else
  36. // show the email, non-editable
  37. .form-group
  38. label.control-label #{translate("email")}
  39. div.form-control(readonly="true") #{user.email}
  40. if shouldAllowEditingDetails
  41. .form-group
  42. label(for='firstName').control-label #{translate("first_name")}
  43. input.form-control(
  44. type='text',
  45. name='first_name',
  46. value=user.first_name
  47. ng-non-bindable
  48. )
  49. .form-group
  50. label(for='lastName').control-label #{translate("last_name")}
  51. input.form-control(
  52. type='text',
  53. name='last_name',
  54. value=user.last_name
  55. ng-non-bindable
  56. )
  57. .actions
  58. button.btn.btn-primary(
  59. type='submit',
  60. ng-disabled="settingsForm.$invalid"
  61. ) #{translate("update")}
  62. else
  63. .form-group
  64. label.control-label #{translate("first_name")}
  65. div.form-control(readonly="true") #{user.first_name}
  66. .form-group
  67. label.control-label #{translate("last_name")}
  68. div.form-control(readonly="true") #{user.last_name}
  69. if !externalAuthenticationSystemUsed()
  70. .col-md-5.col-md-offset-1
  71. h3 #{translate("change_password")}
  72. form(async-form="changepassword", name="changePasswordForm", action="/user/password/update", method="POST", novalidate)
  73. input(type="hidden", name="_csrf", value=csrfToken)
  74. .form-group
  75. label(for='currentPassword') #{translate("current_password")}
  76. input.form-control(
  77. type='password',
  78. name='currentPassword',
  79. placeholder='*********',
  80. ng-model="currentPassword",
  81. required
  82. )
  83. span.small.text-primary(ng-show="changePasswordForm.currentPassword.$invalid && changePasswordForm.currentPassword.$dirty")
  84. | #{translate("required")}
  85. .form-group
  86. label(for='newPassword1') #{translate("new_password")}
  87. input.form-control(
  88. id='passwordField',
  89. type='password',
  90. name='newPassword1',
  91. placeholder='*********',
  92. ng-model="newPassword1",
  93. required,
  94. complex-password
  95. )
  96. span.small.text-primary(ng-show="changePasswordForm.newPassword1.$error.complexPassword && changePasswordForm.newPassword1.$dirty", ng-bind-html="complexPasswordErrorMessage")
  97. .form-group
  98. label(for='newPassword2') #{translate("confirm_new_password")}
  99. input.form-control(
  100. type='password',
  101. name='newPassword2',
  102. placeholder='*********',
  103. ng-model="newPassword2",
  104. equals="passwordField"
  105. )
  106. span.small.text-primary(ng-show="changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$dirty")
  107. | #{translate("doesnt_match")}
  108. span.small.text-primary(ng-show="!changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$invalid && changePasswordForm.newPassword2.$dirty")
  109. | #{translate("invalid_password")}
  110. .actions
  111. button.btn.btn-primary(
  112. type='submit',
  113. ng-disabled="changePasswordForm.$invalid"
  114. ) #{translate("change")}
  115. | !{moduleIncludes("userSettings", locals)}
  116. hr
  117. h3
  118. | #{translate("sharelatex_beta_program")}
  119. if (user.betaProgram)
  120. p.small
  121. | #{translate("beta_program_already_participating")}
  122. div
  123. a(id="beta-program-participate-link" href="/beta/participate") #{translate("manage_beta_program_membership")}
  124. hr
  125. h3
  126. | #{translate("sessions")}
  127. div
  128. a(id="sessions-link", href="/user/sessions") #{translate("manage_sessions")}
  129. hr
  130. if !externalAuthenticationSystemUsed()
  131. p.small
  132. | #{translate("newsletter_info_and_unsubscribe")}
  133. a(
  134. href,
  135. ng-click="unsubscribe()",
  136. ng-show="subscribed && !unsubscribing"
  137. ) #{translate("unsubscribe")}
  138. span(
  139. ng-show="unsubscribing"
  140. )
  141. i.fa.fa-spin.fa-refresh
  142. | #{translate("unsubscribing")}
  143. span.text-success(
  144. ng-show="!subscribed"
  145. )
  146. i.fa.fa-check
  147. | #{translate("unsubscribed")}
  148. p #{translate("need_to_leave")}
  149. a(href, ng-click="deleteAccount()") #{translate("delete_your_account")}
  150. script(type='text/ng-template', id='deleteAccountModalTemplate')
  151. .modal-header
  152. h3 #{translate("delete_account")}
  153. div.modal-body#delete-account-modal
  154. p !{translate("delete_account_warning_message_3")}
  155. form(novalidate, name="deleteAccountForm")
  156. label #{translate('email')}
  157. input.form-control(
  158. type="text",
  159. autocomplete="off",
  160. placeholder="",
  161. ng-model="state.deleteText",
  162. focus-on="open",
  163. ng-keyup="checkValidation()"
  164. )
  165. label #{translate('password')}
  166. input.form-control(
  167. type="password",
  168. autocomplete="off",
  169. placeholder="",
  170. ng-model="state.password",
  171. ng-keyup="checkValidation()"
  172. )
  173. div(ng-if="state.error")
  174. div.alert.alert-danger
  175. | #{translate('generic_something_went_wrong')}
  176. div(ng-if="state.invalidCredentials")
  177. div.alert.alert-danger
  178. | #{translate('email_or_password_wrong_try_again')}
  179. .modal-footer
  180. button.btn.btn-default(
  181. ng-click="cancel()"
  182. ) #{translate("cancel")}
  183. button.btn.btn-danger(
  184. ng-disabled="!state.isValid || state.inflight"
  185. ng-click="delete()"
  186. )
  187. span(ng-hide="state.inflight") #{translate("delete")}
  188. span(ng-show="state.inflight") #{translate("deleting")}...
  189. script(type='text/javascript').
  190. window.passwordStrengthOptions = !{JSON.stringify(settings.passwordStrengthOptions || {})}