settings.pug 9.7 KB

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