settings.pug 7.8 KB

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