settings.pug 7.3 KB

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