settings.pug 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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="{ pdateOn: '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(
  42. readonly="true",
  43. ng-non-bindable
  44. ) #{user.email}
  45. if shouldAllowEditingDetails
  46. .form-group
  47. label(for='firstName').control-label #{translate("first_name")}
  48. input.form-control(
  49. type='text',
  50. name='first_name',
  51. value=user.first_name
  52. ng-non-bindable
  53. )
  54. .form-group
  55. label(for='lastName').control-label #{translate("last_name")}
  56. input.form-control(
  57. type='text',
  58. name='last_name',
  59. value=user.last_name
  60. ng-non-bindable
  61. )
  62. .actions
  63. button.btn.btn-primary(
  64. type='submit',
  65. ng-disabled="settingsForm.$invalid"
  66. ) #{translate("update")}
  67. else
  68. .form-group
  69. label.control-label #{translate("first_name")}
  70. div.form-control(
  71. readonly="true",
  72. ng-non-bindable
  73. ) #{user.first_name}
  74. .form-group
  75. label.control-label #{translate("last_name")}
  76. div.form-control(
  77. readonly="true",
  78. ng-non-bindable
  79. ) #{user.last_name}
  80. .col-md-5.col-md-offset-1
  81. h3 #{translate("change_password")}
  82. if externalAuthenticationSystemUsed() && !settings.overleaf
  83. p
  84. Password settings are managed externally
  85. else if !hasPassword
  86. p
  87. | #[a(href="/user/password/reset", target='_blank') #{translate("no_existing_password")}]
  88. else
  89. - var submitAction
  90. if settings.overleaf
  91. - submitAction = '/user/change_password/v1'
  92. else
  93. - submitAction = '/user/password/update'
  94. form(
  95. async-form="changepassword"
  96. name="changePasswordForm"
  97. action=submitAction
  98. method="POST"
  99. novalidate
  100. )
  101. input(type="hidden", name="_csrf", value=csrfToken)
  102. .form-group
  103. label(for='currentPassword') #{translate("current_password")}
  104. input.form-control(
  105. type='password',
  106. name='currentPassword',
  107. placeholder='*********',
  108. ng-model="currentPassword",
  109. required
  110. )
  111. span.small.text-primary(ng-show="changePasswordForm.currentPassword.$invalid && changePasswordForm.currentPassword.$dirty")
  112. | #{translate("required")}
  113. .form-group
  114. label(for='newPassword1') #{translate("new_password")}
  115. input.form-control(
  116. id='passwordField',
  117. type='password',
  118. name='newPassword1',
  119. placeholder='*********',
  120. ng-model="newPassword1",
  121. required,
  122. complex-password
  123. )
  124. span.small.text-primary(ng-show="changePasswordForm.newPassword1.$error.complexPassword && changePasswordForm.newPassword1.$dirty", ng-bind-html="complexPasswordErrorMessage")
  125. .form-group
  126. label(for='newPassword2') #{translate("confirm_new_password")}
  127. input.form-control(
  128. type='password',
  129. name='newPassword2',
  130. placeholder='*********',
  131. ng-model="newPassword2",
  132. equals="passwordField"
  133. )
  134. span.small.text-primary(ng-show="changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$dirty")
  135. | #{translate("doesnt_match")}
  136. span.small.text-primary(ng-show="!changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$invalid && changePasswordForm.newPassword2.$dirty")
  137. | #{translate("invalid_password")}
  138. .actions
  139. button.btn.btn-primary(
  140. type='submit',
  141. ng-disabled="changePasswordForm.$invalid"
  142. ) #{translate("change")}
  143. | !{moduleIncludes("userSettings", locals)}
  144. hr
  145. h3
  146. | #{translate("sharelatex_beta_program")}
  147. if (user.betaProgram)
  148. p.small
  149. | #{translate("beta_program_already_participating")}
  150. div
  151. a(id="beta-program-participate-link" href="/beta/participate") #{translate("manage_beta_program_membership")}
  152. hr
  153. h3
  154. | #{translate("sessions")}
  155. div
  156. a(id="sessions-link", href="/user/sessions") #{translate("manage_sessions")}
  157. if settings.overleaf && !hasFeature('oauth') && !previewOauth
  158. hr
  159. p
  160. | To manage your account's connection to Google, Twitter, ORCID and IEEE, please
  161. |
  162. a(href="/sign_in_to_v1?return_to=/users/edit#linked-accounts") click here
  163. | .
  164. else if hasFeature('oauth') || previewOauth
  165. hr
  166. include settings/user-oauth
  167. hr
  168. if !externalAuthenticationSystemUsed() || (settings.createV1AccountOnLogin && settings.overleaf)
  169. p.small
  170. | #{translate("newsletter_info_and_unsubscribe")}
  171. a(
  172. href,
  173. ng-click="unsubscribe()",
  174. ng-show="subscribed && !unsubscribing"
  175. ) #{translate("unsubscribe")}
  176. span(
  177. ng-show="unsubscribing"
  178. )
  179. i.fa.fa-spin.fa-refresh(aria-hidden="true")
  180. | #{translate("unsubscribing")}
  181. span.text-success(
  182. ng-show="!subscribed"
  183. )
  184. i.fa.fa-check(aria-hidden="true")
  185. | #{translate("unsubscribed")}
  186. if !settings.overleaf && user.overleaf
  187. p
  188. | Please note: If you have linked your account with Overleaf
  189. | v2, then deleting your ShareLaTeX account will also delete
  190. | account and all of it's associated projects and data.
  191. p #{translate("need_to_leave")}
  192. a(href, ng-click="deleteAccount()") #{translate("delete_your_account")}
  193. script(type='text/ng-template', id='deleteAccountModalTemplate')
  194. .modal-header
  195. h3 #{translate("delete_account")}
  196. div.modal-body#delete-account-modal
  197. p !{translate("delete_account_warning_message_3")}
  198. if settings.createV1AccountOnLogin && settings.overleaf
  199. if settings.forceImportToV2
  200. p
  201. strong
  202. | Your Overleaf v2 projects will be deleted if you delete your account.
  203. | If you want to remove any remaining Overleaf v1 projects in your account,
  204. | please first make sure they are imported to Overleaf v2.
  205. else
  206. p
  207. strong
  208. | This will also delete your user account on #[a(href='/sign_in_to_v1?return_to=/dash%3Fprefer-v1-dash%3D1' target="_blank") Overleaf v1].
  209. | If you want to remove your projects from Overleaf v1, you must do this before you
  210. | delete your account by going to your My Projects page in Overleaf v1, moving your
  211. | projects to the Trash, and then from there either ‘leaving’ or ‘purging’ them, as appropriate.
  212. form(novalidate, name="deleteAccountForm")
  213. label #{translate('email')}
  214. input.form-control(
  215. type="text",
  216. autocomplete="off",
  217. placeholder="",
  218. ng-model="state.deleteText",
  219. focus-on="open",
  220. ng-keyup="checkValidation()"
  221. )
  222. label #{translate('password')}
  223. input.form-control(
  224. type="password",
  225. autocomplete="off",
  226. placeholder="",
  227. ng-model="state.password",
  228. ng-keyup="checkValidation()"
  229. )
  230. div.confirmation-checkbox-wrapper
  231. input(
  232. type="checkbox"
  233. ng-model="state.confirmV1Purge"
  234. ng-change="checkValidation()"
  235. ).pull-left
  236. label(style="display: inline")  I have left, purged or imported my projects on Overleaf v1 (if any)  
  237. div.confirmation-checkbox-wrapper
  238. input(
  239. type="checkbox"
  240. ng-model="state.confirmSharelatexDelete"
  241. ng-change="checkValidation()"
  242. ).pull-left
  243. 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 }}]
  244. div(ng-if="state.error")
  245. div.alert.alert-danger
  246. | #{translate('generic_something_went_wrong')}
  247. div(ng-if="state.invalidCredentials")
  248. div.alert.alert-danger
  249. | #{translate('email_or_password_wrong_try_again')}
  250. if settings.createV1AccountOnLogin && settings.overleaf
  251. div(ng-if="state.error || state.invalidCredentials")
  252. div.alert.alert-info
  253. | If you can't remember your password, or if you are using Single-Sign-On with another provider
  254. | to sign in (such as Twitter or Google), please
  255. | #[a(href="/user/password/reset", target='_blank') reset your password],
  256. | and try again.
  257. .modal-footer
  258. button.btn.btn-default(
  259. ng-click="cancel()"
  260. ) #{translate("cancel")}
  261. button.btn.btn-danger(
  262. ng-disabled="!state.isValid || state.inflight"
  263. ng-click="delete()"
  264. )
  265. span(ng-hide="state.inflight") #{translate("delete")}
  266. span(ng-show="state.inflight") #{translate("deleting")}...
  267. script(type='text/javascript').
  268. window.passwordStrengthOptions = !{JSON.stringify(settings.passwordStrengthOptions || {})}