settings.pug 7.5 KB

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