settings.pug 10 KB

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