settings.jade 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. .form-group
  41. label(for='firstName').control-label #{translate("first_name")}
  42. input.form-control(
  43. type='text',
  44. name='first_name',
  45. value=user.first_name
  46. )
  47. .form-group
  48. label(for='lastName').control-label #{translate("last_name")}
  49. input.form-control(
  50. type='text',
  51. name='last_name',
  52. value=user.last_name
  53. )
  54. .actions
  55. button.btn.btn-primary(
  56. type='submit',
  57. ng-disabled="settingsForm.$invalid"
  58. ) #{translate("update")}
  59. if !externalAuthenticationSystemUsed()
  60. .col-md-5.col-md-offset-1
  61. h3 #{translate("change_password")}
  62. form(async-form="changepassword", name="changePasswordForm", action="/user/password/update", method="POST", novalidate)
  63. input(type="hidden", name="_csrf", value=csrfToken)
  64. .form-group
  65. label(for='currentPassword') #{translate("current_password")}
  66. input.form-control(
  67. type='password',
  68. name='currentPassword',
  69. placeholder='*********',
  70. ng-model="currentPassword",
  71. required
  72. )
  73. span.small.text-primary(ng-show="changePasswordForm.currentPassword.$invalid && changePasswordForm.currentPassword.$dirty")
  74. | #{translate("required")}
  75. .form-group
  76. label(for='newPassword1') #{translate("new_password")}
  77. input.form-control(
  78. id='passwordField',
  79. type='password',
  80. name='newPassword1',
  81. placeholder='*********',
  82. ng-model="newPassword1",
  83. required,
  84. complex-password
  85. )
  86. span.small.text-primary(ng-show="changePasswordForm.newPassword1.$error.complexPassword && changePasswordForm.newPassword1.$dirty", ng-bind-html="complexPasswordErrorMessage")
  87. .form-group
  88. label(for='newPassword2') #{translate("confirm_new_password")}
  89. input.form-control(
  90. type='password',
  91. name='newPassword2',
  92. placeholder='*********',
  93. ng-model="newPassword2",
  94. equals="passwordField"
  95. )
  96. span.small.text-primary(ng-show="changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$dirty")
  97. | #{translate("doesnt_match")}
  98. span.small.text-primary(ng-show="!changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$invalid && changePasswordForm.newPassword2.$dirty")
  99. | #{translate("Invalid Password")}
  100. .actions
  101. button.btn.btn-primary(
  102. type='submit',
  103. ng-disabled="changePasswordForm.$invalid"
  104. ) #{translate("change")}
  105. | !{moduleIncludes("userSettings", locals)}
  106. hr
  107. h3
  108. | #{translate("sharelatex_beta_program")}
  109. if (user.betaProgram)
  110. p.small
  111. | #{translate("beta_program_already_participating")}
  112. div
  113. a(id="beta-program-participate-link" href="/beta/participate") #{translate("manage_beta_program_membership")}
  114. hr
  115. h3
  116. | #{translate("sessions")}
  117. div
  118. a(id="sessions-link", href="/user/sessions") #{translate("manage_sessions")}
  119. hr
  120. if !externalAuthenticationSystemUsed()
  121. p.small
  122. | #{translate("newsletter_info_and_unsubscribe")}
  123. a(
  124. href,
  125. ng-click="unsubscribe()",
  126. ng-show="subscribed && !unsubscribing"
  127. ) #{translate("unsubscribe")}
  128. span(
  129. ng-show="unsubscribing"
  130. )
  131. i.fa.fa-spin.fa-refresh
  132. | #{translate("unsubscribing")}
  133. span.text-success(
  134. ng-show="!subscribed"
  135. )
  136. i.fa.fa-check
  137. | #{translate("unsubscribed")}
  138. p #{translate("need_to_leave")}
  139. a(href, ng-click="deleteAccount()") #{translate("delete_your_account")}
  140. script(type='text/ng-template', id='deleteAccountModalTemplate')
  141. .modal-header
  142. h3 #{translate("delete_account")}
  143. div.modal-body#delete-account-modal
  144. p !{translate("delete_account_warning_message_3")}
  145. form(novalidate, name="deleteAccountForm")
  146. label #{translate('email')}
  147. input.form-control(
  148. type="text",
  149. autocomplete="off",
  150. placeholder="",
  151. ng-model="state.deleteText",
  152. focus-on="open",
  153. ng-keyup="checkValidation()"
  154. )
  155. label #{translate('password')}
  156. input.form-control(
  157. type="password",
  158. autocomplete="off",
  159. placeholder="",
  160. ng-model="state.password",
  161. ng-keyup="checkValidation()"
  162. )
  163. div(ng-if="state.error")
  164. div.alert.alert-danger
  165. | #{translate('generic_something_went_wrong')}
  166. div(ng-if="state.invalidCredentials")
  167. div.alert.alert-danger
  168. | #{translate('email_or_password_wrong_try_again')}
  169. .modal-footer
  170. button.btn.btn-default(
  171. ng-click="cancel()"
  172. ) #{translate("cancel")}
  173. button.btn.btn-danger(
  174. ng-disabled="!state.isValid || state.inflight"
  175. ng-click="delete()"
  176. )
  177. span(ng-hide="state.inflight") #{translate("delete")}
  178. span(ng-show="state.inflight") #{translate("deleting")}...
  179. script(type='text/javascript').
  180. window.passwordStrengthOptions = !{JSON.stringify(settings.passwordStrengthOptions || {})}