settings.pug 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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="{ updateOn: '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. - 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. id="currentPassword"
  109. type='password',
  110. name='currentPassword',
  111. placeholder='*********',
  112. ng-model="currentPassword",
  113. required
  114. )
  115. span.small.text-danger(ng-show="changePasswordForm.currentPassword.$invalid && changePasswordForm.currentPassword.$dirty" aria-live="polite")
  116. | #{translate("required")}
  117. .form-group
  118. label(for='passwordField') #{translate("new_password")}
  119. input.form-control(
  120. id='passwordField',
  121. type='password',
  122. name='newPassword1',
  123. placeholder='*********',
  124. ng-model="newPassword1",
  125. required,
  126. complex-password
  127. )
  128. span.small.text-danger(ng-show="changePasswordForm.newPassword1.$error.complexPassword && changePasswordForm.newPassword1.$dirty", ng-bind-html="complexPasswordErrorMessage" aria-live="polite")
  129. .form-group
  130. label(for='newPassword2') #{translate("confirm_new_password")}
  131. input.form-control(
  132. id="newPassword2"
  133. type='password',
  134. name='newPassword2',
  135. placeholder='*********',
  136. ng-model="newPassword2",
  137. equals="passwordField"
  138. )
  139. span.small.text-danger(ng-show="changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$dirty" aria-live="polite")
  140. | #{translate("doesnt_match")}
  141. span.small.text-danger(ng-show="!changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$invalid && changePasswordForm.newPassword2.$dirty" aria-live="polite")
  142. | #{translate("invalid_password")}
  143. .form-group
  144. form-messages(aria-live="polite" for="changePasswordForm")
  145. .actions
  146. button.btn.btn-primary(
  147. type='submit',
  148. ng-disabled="changePasswordForm.$invalid"
  149. ) #{translate("change")}
  150. | !{moduleIncludes("userSettings", locals)}
  151. hr
  152. h3
  153. | #{translate("sharelatex_beta_program")}
  154. if (user.betaProgram)
  155. p.small
  156. | #{translate("beta_program_already_participating")}
  157. div
  158. a(id="beta-program-participate-link" href="/beta/participate") #{translate("manage_beta_program_membership")}
  159. hr
  160. h3
  161. | #{translate("sessions")}
  162. div
  163. a(id="sessions-link", href="/user/sessions") #{translate("manage_sessions")}
  164. if hasFeature('oauth')
  165. hr
  166. include settings/user-oauth
  167. hr
  168. if !externalAuthenticationSystemUsed() || (settings.createV1AccountOnLogin && settings.overleaf)
  169. p.small
  170. | #{translate("newsletter_info_and_unsubscribe")}
  171. a(
  172. href,
  173. ng-click="unsubscribe()",
  174. ng-show="subscribed && !unsubscribing"
  175. ) #{translate("unsubscribe")}
  176. span(
  177. ng-show="unsubscribing"
  178. )
  179. i.fa.fa-spin.fa-refresh(aria-hidden="true")
  180. | #{translate("unsubscribing")}
  181. span.text-success(
  182. ng-show="!subscribed"
  183. )
  184. i.fa.fa-check(aria-hidden="true")
  185. | #{translate("unsubscribed")}
  186. if !settings.overleaf && user.overleaf
  187. p
  188. | Please note: If you have linked your account with Overleaf
  189. | v2, then deleting your ShareLaTeX account will also delete
  190. | account and all of it's associated projects and data.
  191. p #{translate("need_to_leave")}
  192. a(href, ng-click="deleteAccount()") #{translate("delete_your_account")}
  193. script(type='text/ng-template', id='deleteAccountModalTemplate')
  194. .modal-header
  195. h3 #{translate("delete_account")}
  196. div.modal-body#delete-account-modal
  197. p !{translate("delete_account_warning_message_3")}
  198. if settings.createV1AccountOnLogin && settings.overleaf
  199. p
  200. strong
  201. | Your Overleaf v2 projects will be deleted if you delete your account.
  202. | If you want to remove any remaining Overleaf v1 projects in your account,
  203. | please first make sure they are imported to Overleaf v2.
  204. if settings.overleaf && !hasPassword
  205. p
  206. b
  207. | #[a(href="/user/password/reset", target='_blank') #{translate("delete_acct_no_existing_pw")}].
  208. else
  209. form(novalidate, name="deleteAccountForm")
  210. label #{translate('email')}
  211. input.form-control(
  212. type="text",
  213. autocomplete="off",
  214. placeholder="",
  215. ng-model="state.deleteText",
  216. focus-on="open",
  217. ng-keyup="checkValidation()"
  218. )
  219. label #{translate('password')}
  220. input.form-control(
  221. type="password",
  222. autocomplete="off",
  223. placeholder="",
  224. ng-model="state.password",
  225. ng-keyup="checkValidation()"
  226. )
  227. div.confirmation-checkbox-wrapper
  228. input(
  229. type="checkbox"
  230. ng-model="state.confirmSharelatexDelete"
  231. ng-change="checkValidation()"
  232. ).pull-left
  233. label(style="display: inline")  I understand this will delete all projects in my Overleaf account with email address #[em {{ userDefaultEmail }}]
  234. div(ng-if="state.error")
  235. div.alert.alert-danger(ng-switch="state.error.code")
  236. span(ng-switch-when="InvalidCredentialsError")
  237. | #{translate('email_or_password_wrong_try_again')}
  238. span(ng-switch-when="SubscriptionAdminDeletionError")
  239. | #{translate('subscription_admins_cannot_be_deleted')}
  240. span(ng-switch-when="UserDeletionError")
  241. | #{translate('user_deletion_error')}
  242. span(ng-switch-default)
  243. | #{translate('generic_something_went_wrong')}
  244. if settings.createV1AccountOnLogin && settings.overleaf
  245. div(ng-if="state.error && state.error.code == 'InvalidCredentialsError'")
  246. div.alert.alert-info
  247. | If you can't remember your password, or if you are using Single-Sign-On with another provider
  248. | to sign in (such as Twitter or Google), please
  249. | #[a(href="/user/password/reset", target='_blank') reset your password],
  250. | and try again.
  251. .modal-footer
  252. button.btn.btn-default(
  253. ng-click="cancel()"
  254. ) #{translate("cancel")}
  255. button.btn.btn-danger(
  256. ng-disabled="!state.isValid || state.inflight"
  257. ng-click="delete()"
  258. )
  259. span(ng-hide="state.inflight") #{translate("delete")}
  260. span(ng-show="state.inflight") #{translate("deleting")}…
  261. script(type='text/javascript').
  262. window.passwordStrengthOptions = !{StringHelper.stringifyJsonForScript(settings.passwordStrengthOptions || {})}