settings.pug 11 KB

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