Merge pull request #29614 from overleaf/ii-domain-capture-mu-email-check

[web] Check email from SAML callback before enrollment page

GitOrigin-RevId: 3c8224d42b87969290d5031a28d4ec217e875d84
This commit is contained in:
ilkin-overleaf
2025-11-19 09:05:43 +00:00
committed by Copybot
parent d65f5a416c
commit e81ca06f9c
4 changed files with 55 additions and 15 deletions
@@ -83,24 +83,59 @@ describe('<DomainCapture />', function () {
})
})
it('renders institution error message', function () {
const errorMsg = 'Error message'
const notificationsInstitution = [
{
templateKey: 'notification_institution_sso_error',
error: {
message: errorMsg,
describe('notifications', function () {
it('renders missing email on account error message', function () {
const institutionEmail = 'email@example.com'
const notificationsInstitution = [
{
templateKey: 'notification_email_not_in_account',
institutionEmail,
},
},
]
cy.window().then(win => {
win.metaAttributesCache.set(
'ol-notificationsInstitution',
notificationsInstitution
]
cy.window().then(win => {
win.metaAttributesCache.set(
'ol-notificationsInstitution',
notificationsInstitution
)
})
cy.mount(<DomainCapture />)
cy.findByRole('alert').should(
'contain.text',
`Your identity provider returned ${institutionEmail}, which ` +
`is not already on your current Overleaf account. You will need to ` +
`log out and create a new Overleaf account with ${institutionEmail} ` +
`via the SSO log in page. Once this is done, you can ` +
`transfer your existing projects to the new account.`
)
cy.findByRole('link', {
name: /transfer your existing projects/i,
}).should(
'have.attr',
'href',
'/learn/how-to/How_to_Transfer_Project_Ownership'
)
})
cy.mount(<DomainCapture />)
cy.findByRole('alert').should('contain.text', errorMsg)
it('renders institution error message', function () {
const errorMsg = 'Error message'
const notificationsInstitution = [
{
templateKey: 'notification_institution_sso_error',
error: {
message: errorMsg,
},
},
]
cy.window().then(win => {
win.metaAttributesCache.set(
'ol-notificationsInstitution',
notificationsInstitution
)
})
cy.mount(<DomainCapture />)
cy.findByRole('alert').should('contain.text', errorMsg)
})
})
})