From cabb12fdeaa17993376570c3186201dbf44e6bf1 Mon Sep 17 00:00:00 2001 From: andrewHEguardian <114918544+andrewHEguardian@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:00:31 +0100 Subject: [PATCH] add message if user tries to go to newspaper auth without correct product --- .../mma/accountoverview/AccountOverview.tsx | 2 ++ .../accountoverview/MaybeNewspaperArchiveInfo.tsx | 15 +++++++++++++++ server/routes/newspaperArchive.ts | 3 +-- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 client/components/mma/accountoverview/MaybeNewspaperArchiveInfo.tsx diff --git a/client/components/mma/accountoverview/AccountOverview.tsx b/client/components/mma/accountoverview/AccountOverview.tsx index 527839b00..1c4b4809f 100644 --- a/client/components/mma/accountoverview/AccountOverview.tsx +++ b/client/components/mma/accountoverview/AccountOverview.tsx @@ -51,6 +51,7 @@ import { PaymentFailureAlertIfApplicable } from '../shared/PaymentFailureAlertIf import { CancelledProductCard } from './CancelledProductCard'; import { EmptyAccountOverview } from './EmptyAccountOverview'; import { InAppPurchaseCard } from './InAppPurchaseCard'; +import { MaybeNewspaperArchiveInfo } from './MaybeNewspaperArchiveInfo'; import { PersonalisedHeader } from './PersonalisedHeader'; import { ProductCard } from './ProductCard'; import { SingleContributionCard } from './SingleContributionCard'; @@ -196,6 +197,7 @@ const AccountOverviewPage = ({ isFromApp }: IsFromAppProps) => { mdapiResponse={mdapiResponse} mpapiResponse={mpapiResponse} /> + + ) : null; +} diff --git a/server/routes/newspaperArchive.ts b/server/routes/newspaperArchive.ts index ab86d6e8e..6bd1e9a69 100644 --- a/server/routes/newspaperArchive.ts +++ b/server/routes/newspaperArchive.ts @@ -45,8 +45,7 @@ router.get('/auth', async (req: Request, res: Response) => { const hasCorrectEntitlement = await checkSupporterEntitlement(req); if (!hasCorrectEntitlement) { - // ToDo: show the user an error/info page - return res.redirect('/'); + return res.redirect('/?missingNewspaperArchiveEntitlement=true'); } const authHeader = base64(`${authString}`);