From d6445b18dd98ffb0e59580f80ba3ec3fd711477d Mon Sep 17 00:00:00 2001 From: dbes-gds Date: Tue, 21 May 2024 17:24:14 +0100 Subject: [PATCH] BAU: test sonarcloud quality gate --- .../sign-in-or-create-controller-copy.ts | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/components/sign-in-or-create/sign-in-or-create-controller-copy.ts diff --git a/src/components/sign-in-or-create/sign-in-or-create-controller-copy.ts b/src/components/sign-in-or-create/sign-in-or-create-controller-copy.ts new file mode 100644 index 000000000..b5afdee97 --- /dev/null +++ b/src/components/sign-in-or-create/sign-in-or-create-controller-copy.ts @@ -0,0 +1,35 @@ +import { Request, Response } from "express"; +import { getNextPathAndUpdateJourney } from "../common/constants"; +import { USER_JOURNEY_EVENTS } from "../common/state-machine/state-machine"; + +export async function signInOrCreateGet( + req: Request, + res: Response +): Promise { + req.session.user.isAccountCreationJourney = false; + req.session.user.isPasswordResetJourney = false; + req.session.user.isSignInJourney = false; + if (req.query.redirectPost) { + return await signInOrCreatePost(req, res); + } + res.render("sign-in-or-create/index.njk", { + serviceType: req.session.client.serviceType, + }); +} + +export async function signInOrCreatePost( + req: Request, + res: Response +): Promise { + res.redirect( + await getNextPathAndUpdateJourney( + req, + req.path, + req.body.optionSelected === "create" + ? USER_JOURNEY_EVENTS.CREATE_NEW_ACCOUNT + : USER_JOURNEY_EVENTS.SIGN_IN, + null, + res.locals.sessionId + ) + ); +}