Skip to content

Commit 04fbcd2

Browse files
committed
feat: Allow setting appClientId to maj to indicate secondary user flow
1 parent 3aa63e4 commit 04fbcd2

6 files changed

Lines changed: 43 additions & 9 deletions

File tree

src/client/layouts/MinimalLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { GatewayErrorSummary } from '@/client/components/GatewayErrorSummary';
3030
interface MinimalLayoutProps {
3131
children?: React.ReactNode;
3232
wide?: boolean;
33-
pageHeader: string;
33+
pageHeader?: string;
3434
leadText?: React.ReactNode;
3535
imageId?: DecorativeImageId;
3636
successOverride?: string;

src/client/pages/IframedRegisterWithEmail.stories.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,17 @@ Default.story = {
2525
name: 'with defaults',
2626
};
2727

28-
export const Email = (args: RegistrationProps) => (
29-
<IframedRegisterWithEmail {...args} email="someone@theguardian.com" />
28+
export const MultipleAccountJourney = (args: RegistrationProps) => (
29+
<IframedRegisterWithEmail
30+
{...args}
31+
queryParams={{
32+
returnUrl: 'https://www.theguardian.com/uk',
33+
appClientId: 'maj',
34+
}}
35+
/>
3036
);
31-
Email.story = {
32-
name: 'with email',
37+
MultipleAccountJourney.story = {
38+
name: 'with multiple account journey',
3339
};
3440

3541
export const InvalidRecaptcha = (args: RegistrationProps) => (

src/client/pages/IframedRegisterWithEmail.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { SUPPORT_EMAIL } from '@/shared/model/Configuration';
1212
import { PasscodeErrors } from '@/shared/model/Errors';
1313
import IframeThemedEmailInput from '../components/IframeThemedEmailInput';
1414
import { disableAutofillBackground } from '../styles/Shared';
15+
import { RegistrationConsents } from '../components/RegistrationConsents';
1516

1617
type RegisterWithEmailProps = RegistrationProps & {
1718
shortRequestId?: string;
@@ -47,14 +48,19 @@ export const IframedRegisterWithEmail = ({
4748
shortRequestId,
4849
pageError,
4950
}: RegisterWithEmailProps) => {
51+
const isMultipleAccountFlow = queryParams.appClientId === 'maj';
5052
const formTrackingName = 'register-iframed';
5153

5254
usePageLoadOphanInteraction(formTrackingName);
5355

5456
return (
5557
<MinimalLayout
56-
pageHeader="Create your account"
57-
leadText="Unlock your premium experience, online and in the app."
58+
pageHeader={isMultipleAccountFlow ? undefined : 'Create your account'}
59+
leadText={
60+
isMultipleAccountFlow
61+
? undefined
62+
: 'Unlock your premium experience, online and in the app.'
63+
}
5864
shortRequestId={shortRequestId}
5965
errorContext={getErrorContext(pageError)}
6066
errorOverride={pageError}
@@ -94,6 +100,7 @@ export const IframedRegisterWithEmail = ({
94100
autoComplete="off"
95101
/>
96102
)}
103+
{isMultipleAccountFlow && <RegistrationConsents />}
97104
</MainForm>
98105
</MinimalLayout>
99106
);

src/client/pages/IframedSignIn.stories.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,17 @@ export const NoSocialButtonsEmail = (args: IframedSignInProps) => (
159159
NoSocialButtonsEmail.story = {
160160
name: 'no social buttons with email',
161161
};
162+
163+
export const MultipleAccountJourney = (args: IframedSignInProps) => (
164+
<IframedSignIn
165+
{...args}
166+
hideSocialButtons={true}
167+
queryParams={{
168+
returnUrl: 'https://www.theguardian.com/uk',
169+
appClientId: 'maj',
170+
}}
171+
/>
172+
);
173+
MultipleAccountJourney.story = {
174+
name: 'multiple account journey',
175+
};

src/client/pages/IframedSignIn.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export const IframedSignIn = ({
139139
shortRequestId,
140140
hideSocialButtons = false,
141141
}: IframedSignInProps) => {
142+
const isMultipleAccountFlow = queryParams.appClientId === 'maj';
142143
const formTrackingName = 'sign-in';
143144

144145
// The page level error is equivalent to this enum if social signin has been blocked.
@@ -151,8 +152,12 @@ export const IframedSignIn = ({
151152
<MinimalLayout
152153
errorContext={getErrorContext(pageError, queryParams)}
153154
errorOverride={pageError}
154-
pageHeader="Sign in to your account"
155-
leadText="This unlocks your premium experience, online and in the app."
155+
pageHeader={isMultipleAccountFlow ? undefined : 'Sign in to your account'}
156+
leadText={
157+
isMultipleAccountFlow
158+
? undefined
159+
: 'This unlocks your premium experience, online and in the app.'
160+
}
156161
shortRequestId={shortRequestId}
157162
overrideTheme="iframe-light"
158163
>

src/server/routes/dev.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ router.get('/', async (req: Request, res: ResponseWithRequestState) => {
7676
<li><a href="/signout">Sign Out</a></li>
7777
<li><a href="/delete">Delete Account</a></li>
7878
<li><a href="/maintenance">Maintenance</a></li>
79+
<li><a href="/iframed/signin">Iframed Sign-in</a> | <a href="/iframed/signin?appClientId=maj">Iframed Sign-in (Multiple Account)</a></li>
80+
<li><a href="/iframed/register/email">Iframed Register</a> | <a href="/iframed/register/email?appClientId=maj">Iframed Register (Multiple Account)</a></li>
7981
</ul>
8082
</body>
8183
</html>

0 commit comments

Comments
 (0)