overleaf/services/web/app/views/user/passwordReset.pug
Jessica Lawshe b2b100d485 Merge pull request #17090 from overleaf/jel-block-password-reset
[web] Block password reset request for managed users linked to SSO

GitOrigin-RevId: 9c990d9fcb7a3286fee733e0fd61c06c09d79367
2024-03-12 09:03:29 +00:00

81 lines
2.9 KiB
Text

extends ../layout-marketing
include ../_mixins/recaptcha
block content
- var showCaptcha = settings.recaptcha && settings.recaptcha.siteKey && !(settings.recaptcha.disabled && settings.recaptcha.disabled.passwordReset)
if showCaptcha
script(type="text/javascript", nonce=scriptNonce, src="https://www.recaptcha.net/recaptcha/api.js?render=explicit")
div(
id="recaptcha"
class="g-recaptcha"
data-sitekey=settings.recaptcha.siteKey
data-size="invisible"
data-badge="inline"
)
main.content.content-alt#main-content(data-ol-captcha-retry-trigger-area="")
.container-custom-sm.mx-auto
.card
form(
data-ol-async-form
name="passwordResetForm"
action="/user/password/reset",
method="POST",
captcha=(showCaptcha ? '' : false),
captcha-action-name=(showCaptcha ? "passwordReset" : false),
)
if error === 'password_reset_token_expired'
h3.mt-0.mb-2 #{translate("sorry_your_token_expired")}
p #{translate('please_request_a_new_password_reset_email_and_follow_the_link')}.
else
h3.mt-0.mb-2(data-ol-not-sent) #{translate("password_reset")}
h3.mt-0.mb-2(hidden data-ol-sent) #{translate("check_your_email")}
p(data-ol-not-sent) #{translate("enter_your_email_address_below_and_we_will_send_you_a_link_to_reset_your_password")}.
div(data-ol-not-sent)
+formMessages()
if error && error !== 'password_reset_token_expired'
div.alert.alert-danger.mb-2(
role="alert"
aria-live="assertive"
)
| #{translate(error)}
div(data-ol-custom-form-message="no-password-allowed-due-to-sso" hidden)
.notification.notification-type-error(aria-live="polite" style="margin-bottom: 10px;")
.notification-icon
span.material-symbols.material-symbols-rounded(aria-hidden="true") error
.notification-content-and-cta
.notification-content
p
| !{translate("you_cant_reset_password_due_to_sso", {}, [{name: 'a', attrs: {href: '/sso-login'}}])}
input(type="hidden", name="_csrf", value=csrfToken)
.form-group.mb-3
label(for='email') #{translate("email")}
input.form-control#email(
aria-label="email"
type='email',
name='email',
placeholder=translate("enter_your_email_address"),
required,
autocomplete="username",
autofocus
)
.actions
button.btn.btn-primary.w-100(
type='submit',
data-ol-disabled-inflight,
aria-label=translate('request_password_reset_to_reconfirm')
)
span(data-ol-inflight="idle")
| #{translate("request_password_reset")}
span(hidden data-ol-inflight="pending")
| #{translate("requesting_password_reset")}…
div(hidden data-ol-sent)
p.mb-4 #{translate('password_reset_email_sent')}
a(href="/login") #{translate('back_to_log_in')}
if showCaptcha
+recaptchaConditions