settings.pug 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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. .col-md-5.col-md-offset-1
  120. h3 #{translate("change_password")}
  121. p
  122. | To change your password,
  123. | please go to #[a(href=settings.overleaf.host+'/users/edit') Overleaf v1 settings]
  124. | !{moduleIncludes("userSettings", locals)}
  125. //- The beta program doesn't make much sense to include while v2 is going
  126. //- but we may want to add it back in later
  127. //- hr
  128. //-
  129. //- h3
  130. //- | #{translate("sharelatex_beta_program")}
  131. //-
  132. //- if (user.betaProgram)
  133. //- p.small
  134. //- | #{translate("beta_program_already_participating")}
  135. //-
  136. //- div
  137. //- a(id="beta-program-participate-link" href="/beta/participate") #{translate("manage_beta_program_membership")}
  138. hr
  139. h3
  140. | #{translate("sessions")}
  141. div
  142. a(id="sessions-link", href="/user/sessions") #{translate("manage_sessions")}
  143. hr
  144. if !externalAuthenticationSystemUsed() || (settings.createV1AccountOnLogin && settings.overleaf)
  145. p.small
  146. | #{translate("newsletter_info_and_unsubscribe")}
  147. a(
  148. href,
  149. ng-click="unsubscribe()",
  150. ng-show="subscribed && !unsubscribing"
  151. ) #{translate("unsubscribe")}
  152. span(
  153. ng-show="unsubscribing"
  154. )
  155. i.fa.fa-spin.fa-refresh
  156. | #{translate("unsubscribing")}
  157. span.text-success(
  158. ng-show="!subscribed"
  159. )
  160. i.fa.fa-check
  161. | #{translate("unsubscribed")}
  162. if !settings.overleaf && user.overleaf
  163. p
  164. | Please note: If you have linked your account with Overleaf
  165. | v2, then deleting your ShareLaTeX account will also delete
  166. | account and all of it's associated projects and data.
  167. p #{translate("need_to_leave")}
  168. a(href, ng-click="deleteAccount()") #{translate("delete_your_account")}
  169. script(type='text/ng-template', id='deleteAccountModalTemplate')
  170. .modal-header
  171. h3 #{translate("delete_account")}
  172. div.modal-body#delete-account-modal
  173. p !{translate("delete_account_warning_message_3")}
  174. if settings.createV1AccountOnLogin && settings.overleaf
  175. p
  176. strong
  177. | This will also delete your user account on #[a(href=settings.overleaf.host target="_blank") Overleaf v1].
  178. | If you want to remove your projects from Overleaf v1, you must do this before you
  179. | delete your account by going to your My Projects page in Overleaf v1, moving your
  180. | projects to the Trash, and then from there either ‘leaving’ or ‘purging’ them, as appropriate.
  181. form(novalidate, name="deleteAccountForm")
  182. label #{translate('email')}
  183. input.form-control(
  184. type="text",
  185. autocomplete="off",
  186. placeholder="",
  187. ng-model="state.deleteText",
  188. focus-on="open",
  189. ng-keyup="checkValidation()"
  190. )
  191. label #{translate('password')}
  192. input.form-control(
  193. type="password",
  194. autocomplete="off",
  195. placeholder="",
  196. ng-model="state.password",
  197. ng-keyup="checkValidation()"
  198. )
  199. div.confirmation-checkbox-wrapper
  200. input(
  201. type="checkbox"
  202. ng-model="state.confirmV1Purge"
  203. ng-change="checkValidation()"
  204. ).pull-left
  205. label(style="display: inline")  I have left or purged my projects on Overleaf v1 (if any)  
  206. div.confirmation-checkbox-wrapper
  207. input(
  208. type="checkbox"
  209. ng-model="state.confirmSharelatexDelete"
  210. ng-change="checkValidation()"
  211. ).pull-left
  212. label(style="display: inline")  I understand this will delete all projects in my Overleaf v2 account (and ShareLaTeX account, if any) with email address #[em {{ userDefaultEmail }}]
  213. div(ng-if="state.error")
  214. div.alert.alert-danger
  215. | #{translate('generic_something_went_wrong')}
  216. div(ng-if="state.invalidCredentials")
  217. div.alert.alert-danger
  218. | #{translate('email_or_password_wrong_try_again')}
  219. if settings.createV1AccountOnLogin && settings.overleaf
  220. div(ng-if="state.error || state.invalidCredentials")
  221. div.alert.alert-info
  222. | If you can't remember your password, or if you are using Single-Sign-On with another provider
  223. | to sign in (such as Twitter or Google), please
  224. | #[a(href=settings.overleaf.host+'/users/password/new', target='_blank') reset your password],
  225. | and try again.
  226. .modal-footer
  227. button.btn.btn-default(
  228. ng-click="cancel()"
  229. ) #{translate("cancel")}
  230. button.btn.btn-danger(
  231. ng-disabled="!state.isValid || state.inflight"
  232. ng-click="delete()"
  233. )
  234. span(ng-hide="state.inflight") #{translate("delete")}
  235. span(ng-show="state.inflight") #{translate("deleting")}...
  236. script(type='text/javascript').
  237. window.passwordStrengthOptions = !{JSON.stringify(settings.passwordStrengthOptions || {})}