settings.pug 11 KB

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