WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@rBangay
Copy link
Contributor

@rBangay rBangay commented Nov 25, 2025

What does this change?

This pr allows gateway to be iframed into support.theguardian.com.

For the first use case gateway is iframed into the supporter onboarding page (the thank you page after making an All-access digital purchase).

The iframed gateway pages need to handle both signin and register flows.

Note

In order to maintain dynamic height resizing of the iframe and communication between the iframe and it's parent page (specifically around reporting the signed in/ register success/failure state and whether a user has click on an anchor link within the iframe) there is a dependancy on client side javascript, and in particular the postMessage method (https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage).

Another note

There was some preparatory work done here (#3270) where we set the frameAncestors CSP directive (https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy/frame-ancestors) which controls which parent domains we consider worthy of the honour of iframing gateway 👑

There was a separate pr in support-frontend (#3270) where we updated the CSP default-src directive to allow gateway to be iframed into support-frontend.

Images

Screenshot 2025-11-25 at 11 02 51

@rBangay rBangay requested a review from a team as a code owner November 25, 2025 11:05
Richard Bangay added 25 commits November 25, 2025 11:26
amend signin controller encrypted cookie signinOrRegister state based on where the journey started
…r flow for people going through the registration journey in order for them to set consents and newsletter consents
…ggling them calls a new authenticated api endpoint instead of submitting the pages form.
…istering) when they reach the /welcome/complete-account page. Wait for them to make a choice. Remove the client side js that set users consents in real time as the user clicked on the toggles.
… supporter onboarding pages of support.theguardian.com

Use fetch instead of form submit to POST to the /passcode endpoint, and then post message back to parent page with user auth status
Minor style amends to make the iframed sign in and register pages look more like the designs (WIP)
remove comments and unused eslint ignore rule

run prettier fix
… of using route path array as the CI jest tests fail otherwise
…-frontend doesn't support theming as of the time of writing this commit, so forcing it to match the design of the only parent page thats using the iframed journey for now.
…gister pages

style amends to the iframed pages to make them more like the supporter onboarding designs (more like support-frontend style which is currently the only consumer of the iframed routes)
…ut component when used inside an iframe to reflect the different spacing in the designs
…mitted via the onSubmit clientside handler.

fix some padding issues

use postMessage to send link click info to the parent page when recaptcha privacy policy or terms linked are clicked (only if the site is being iframed)
@rBangay rBangay force-pushed the rb-al/supporter-onboarding-iframe branch from cf41994 to fb47fb1 Compare November 25, 2025 11:28
@github-actions
Copy link

github-actions bot commented Nov 25, 2025

// if it exists
const email = decryptedEmail || signInEmail || readEmailCookie(req);

const getPath = req.originalUrl as RoutePaths;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this /signin or iframe/signin?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, it should handle both /signin and /iframed/signin

): UserStateChangeStatus => {
const responseUrl = new URL(urlString);
const reponseUrlPath = responseUrl.pathname;
if (reponseUrlPath.startsWith('/welcome')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might be removing this /welcome/exisiting soon but we can potentially resolve this after.

@rBangay rBangay merged commit 7490b43 into main Nov 26, 2025
41 of 43 checks passed
@rBangay rBangay deleted the rb-al/supporter-onboarding-iframe branch November 26, 2025 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants