settings.pug 11 KB

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