settings.pug 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. else
  118. if settings.overleaf && settings.createV1AccountOnLogin
  119. p
  120. | To change your password
  121. | , go to #[a(href=settings.overleaf.host+'/users/edit') Overleaf v1 settings]
  122. | !{moduleIncludes("userSettings", locals)}
  123. //- The beta program doesn't make much sense to include while v2 is going
  124. //- but we may want to add it back in later
  125. //- hr
  126. //-
  127. //- h3
  128. //- | #{translate("sharelatex_beta_program")}
  129. //-
  130. //- if (user.betaProgram)
  131. //- p.small
  132. //- | #{translate("beta_program_already_participating")}
  133. //-
  134. //- div
  135. //- a(id="beta-program-participate-link" href="/beta/participate") #{translate("manage_beta_program_membership")}
  136. hr
  137. h3
  138. | #{translate("sessions")}
  139. div
  140. a(id="sessions-link", href="/user/sessions") #{translate("manage_sessions")}
  141. hr
  142. if !externalAuthenticationSystemUsed() || (settings.createV1AccountOnLogin && settings.overleaf)
  143. p.small
  144. | #{translate("newsletter_info_and_unsubscribe")}
  145. a(
  146. href,
  147. ng-click="unsubscribe()",
  148. ng-show="subscribed && !unsubscribing"
  149. ) #{translate("unsubscribe")}
  150. span(
  151. ng-show="unsubscribing"
  152. )
  153. i.fa.fa-spin.fa-refresh
  154. | #{translate("unsubscribing")}
  155. span.text-success(
  156. ng-show="!subscribed"
  157. )
  158. i.fa.fa-check
  159. | #{translate("unsubscribed")}
  160. if !settings.overleaf && user.overleaf
  161. p
  162. | Please note: If you have linked your account with Overleaf
  163. | v2, then deleting your ShareLaTeX account will also delete
  164. | account and all of it's associated projects and data.
  165. p #{translate("need_to_leave")}
  166. a(href, ng-click="deleteAccount()") #{translate("delete_your_account")}
  167. script(type='text/ng-template', id='deleteAccountModalTemplate')
  168. .modal-header
  169. h3 #{translate("delete_account")}
  170. div.modal-body#delete-account-modal
  171. p !{translate("delete_account_warning_message_3")}
  172. p
  173. strong This will also delete your account on Overleaf v1!
  174. form(novalidate, name="deleteAccountForm")
  175. label #{translate('email')}
  176. input.form-control(
  177. type="text",
  178. autocomplete="off",
  179. placeholder="",
  180. ng-model="state.deleteText",
  181. focus-on="open",
  182. ng-keyup="checkValidation()"
  183. )
  184. label #{translate('password')}
  185. input.form-control(
  186. type="password",
  187. autocomplete="off",
  188. placeholder="",
  189. ng-model="state.password",
  190. ng-keyup="checkValidation()"
  191. )
  192. div(ng-if="state.error")
  193. div.alert.alert-danger
  194. | #{translate('generic_something_went_wrong')}
  195. div(ng-if="state.invalidCredentials")
  196. div.alert.alert-danger
  197. | #{translate('email_or_password_wrong_try_again')}
  198. .modal-footer
  199. button.btn.btn-default(
  200. ng-click="cancel()"
  201. ) #{translate("cancel")}
  202. button.btn.btn-danger(
  203. ng-disabled="!state.isValid || state.inflight"
  204. ng-click="delete()"
  205. )
  206. span(ng-hide="state.inflight") #{translate("delete")}
  207. span(ng-show="state.inflight") #{translate("deleting")}...
  208. script(type='text/javascript').
  209. window.passwordStrengthOptions = !{JSON.stringify(settings.passwordStrengthOptions || {})}