settings.pug 11 KB

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