diff --git a/src/app.constants.ts b/src/app.constants.ts index 541a17632..fe3d37dbc 100644 --- a/src/app.constants.ts +++ b/src/app.constants.ts @@ -30,7 +30,6 @@ export const PATH_NAMES = { CREATE_ACCOUNT_ENTER_PHONE_NUMBER: "/enter-phone-number", CREATE_ACCOUNT_SUCCESSFUL: "/account-created", CHECK_YOUR_PHONE: "/check-your-phone", - SHARE_INFO: "/share-info", UPDATED_TERMS_AND_CONDITIONS: "/updated-terms-and-conditions", ENTER_MFA: "/enter-code", SECURITY_CODE_INVALID: "/security-code-invalid", diff --git a/src/app.ts b/src/app.ts index 581e6b3e5..91154b68f 100644 --- a/src/app.ts +++ b/src/app.ts @@ -53,7 +53,6 @@ import { getSessionIdMiddleware, initialiseSessionMiddleware, } from "./middleware/session-middleware"; -import { shareInfoRouter } from "./components/share-info/share-info-routes"; import { updatedTermsConditionsRouter } from "./components/updated-terms-conditions/updated-terms-conditions-routes"; import { signInOrCreateRouter } from "./components/sign-in-or-create/sign-in-or-create-routes"; import { accountNotFoundRouter } from "./components/account-not-found/account-not-found-routes"; @@ -126,7 +125,6 @@ function registerRoutes(app: express.Application) { app.use(resendMfaCodeAccountCreationRouter); app.use(resendEmailCodeRouter); app.use(signedOutRouter); - app.use(shareInfoRouter); app.use(updatedTermsConditionsRouter); app.use(resetPasswordRouter); if (support2FABeforePasswordReset()) { diff --git a/src/assets/javascript/cookies.js b/src/assets/javascript/cookies.js index e5c52a430..1fbd1c17b 100644 --- a/src/assets/javascript/cookies.js +++ b/src/assets/javascript/cookies.js @@ -90,7 +90,6 @@ var cookies = function () { "sign in", "middle" ), - "/share-info": generateSessionJourney("sign in", "middle"), "/reset-password-check-email": generateSessionJourney( "password reset", "start" diff --git a/src/components/account-created/account-created-controller.ts b/src/components/account-created/account-created-controller.ts index 957270bc2..13dc30240 100644 --- a/src/components/account-created/account-created-controller.ts +++ b/src/components/account-created/account-created-controller.ts @@ -19,9 +19,6 @@ export async function accountCreatedPost( req, req.path, USER_JOURNEY_EVENTS.ACCOUNT_CREATED, - { - isConsentRequired: req.session.user.isConsentRequired, - }, res.locals.sessionId ); diff --git a/src/components/account-created/tests/account-created-controller.test.ts b/src/components/account-created/tests/account-created-controller.test.ts index 1636369a6..40678f979 100644 --- a/src/components/account-created/tests/account-created-controller.test.ts +++ b/src/components/account-created/tests/account-created-controller.test.ts @@ -41,11 +41,5 @@ describe("account created controller", () => { expect(res.redirect).to.have.been.calledWith(PATH_NAMES.AUTH_CODE); }); - it("should redirect to share-info when consent is required", async () => { - req.session.user.isConsentRequired = true; - await accountCreatedPost(req as Request, res as Response); - - expect(res.redirect).to.have.been.calledWith(PATH_NAMES.SHARE_INFO); - }); }); }); diff --git a/src/components/authorize/authorize-controller.ts b/src/components/authorize/authorize-controller.ts index 1251e0795..0be661248 100644 --- a/src/components/authorize/authorize-controller.ts +++ b/src/components/authorize/authorize-controller.ts @@ -97,10 +97,6 @@ export function authorizeGet( req.session.client.rpSectorHost = claims.rp_sector_host; req.session.client.rpRedirectUri = claims.rp_redirect_uri; req.session.client.rpState = claims.rp_state; - - req.session.client.consentEnabled = - startAuthResponse.data.user.consentRequired; - req.session.user.isIdentityRequired = startAuthResponse.data.user.identityRequired; req.session.user.isAuthenticated = @@ -134,7 +130,6 @@ export function authorizeGet( PATH_NAMES.AUTHORIZE, nextStateEvent, { - isConsentRequired: req.session.client.consentEnabled, requiresUplift: req.session.user.isUpliftRequired, isIdentityRequired: req.session.user.isIdentityRequired, isAuthenticated: req.session.user.isAuthenticated, diff --git a/src/components/authorize/claims-config.ts b/src/components/authorize/claims-config.ts index fe2f8d2f0..a13bc5839 100644 --- a/src/components/authorize/claims-config.ts +++ b/src/components/authorize/claims-config.ts @@ -21,7 +21,6 @@ export type Claims = { jti: string; client_name: string; cookie_consent_shared: boolean; - consent_required: boolean; is_one_login_service: boolean; service_type: string; govuk_signin_journey_id: string; @@ -45,7 +44,6 @@ export const requiredClaimsKeys = [ "jti", "client_name", "cookie_consent_shared", - "consent_required", "is_one_login_service", "service_type", "govuk_signin_journey_id", diff --git a/src/components/authorize/tests/authorize-controller.test.ts b/src/components/authorize/tests/authorize-controller.test.ts index ff279c30d..da5541737 100644 --- a/src/components/authorize/tests/authorize-controller.test.ts +++ b/src/components/authorize/tests/authorize-controller.test.ts @@ -48,7 +48,6 @@ describe("authorize controller", () => { fakeAuthorizeService = mockAuthService({ data: { user: { - consentRequired: false, identityRequired: false, upliftRequired: false, authenticated: true, @@ -179,28 +178,8 @@ describe("authorize controller", () => { expect(res.redirect).to.have.calledWith(PATH_NAMES.AUTH_CODE); }); - it("should redirect to /share-info when consent required", async () => { - authServiceResponseData.data.user = { - consentRequired: true, - identityRequired: false, - upliftRequired: false, - authenticated: true, - }; - fakeAuthorizeService = mockAuthService(authServiceResponseData); - - await authorizeGet( - fakeAuthorizeService, - fakeCookieConsentService, - fakeKmsDecryptionService, - fakeJwtService - )(req as Request, res as Response); - - expect(res.redirect).to.have.calledWith(PATH_NAMES.SHARE_INFO); - }); - it("should redirect to /identity page when identity check required", async () => { authServiceResponseData.data.user = { - consentRequired: false, identityRequired: true, upliftRequired: false, authenticated: true, @@ -223,7 +202,6 @@ describe("authorize controller", () => { process.env.SUPPORT_REAUTHENTICATION = "1"; mockClaims.reauthenticate = "123456"; authServiceResponseData.data.user = { - consentRequired: false, identityRequired: false, upliftRequired: false, authenticated: false, @@ -245,7 +223,6 @@ describe("authorize controller", () => { process.env.SUPPORT_REAUTHENTICATION = "0"; mockClaims.reauthenticate = "123456"; authServiceResponseData.data.user = { - consentRequired: false, identityRequired: false, upliftRequired: false, authenticated: false, @@ -278,7 +255,6 @@ describe("authorize controller", () => { it("should redirect to /sign-in-or-create page with _ga query param when present", async () => { const gaTrackingId = "2.172053219.3232.1636392870-444224.1635165988"; authServiceResponseData.data.user = { - consentRequired: false, identityRequired: false, upliftRequired: false, cookieConsent: COOKIE_CONSENT.ACCEPT, @@ -321,7 +297,6 @@ describe("authorize controller", () => { it("should redirect to /doc-checking-app when doc check app user", async () => { authServiceResponseData.data.user = { authenticated: false, - consentRequired: false, docCheckingAppUser: true, }; fakeAuthorizeService = mockAuthService(authServiceResponseData); diff --git a/src/components/authorize/tests/authorize-integration.test.ts b/src/components/authorize/tests/authorize-integration.test.ts index 8d45c7622..5c81a74db 100644 --- a/src/components/authorize/tests/authorize-integration.test.ts +++ b/src/components/authorize/tests/authorize-integration.test.ts @@ -47,13 +47,11 @@ describe("Integration:: authorize", () => { serviceType: "MANDATORY", clientName: "test-client", cookieConsentEnabled: true, - consentEnabled: true, redirectUri: "http://test-redirect.gov.uk/callback", state: "jasldasl12312", isOneLoginService: false, }, user: { - consentRequired: true, upliftRequired: false, identityRequired: false, authenticated: false, diff --git a/src/components/authorize/tests/test-data.ts b/src/components/authorize/tests/test-data.ts index 31993dccb..1faab1ee0 100644 --- a/src/components/authorize/tests/test-data.ts +++ b/src/components/authorize/tests/test-data.ts @@ -9,7 +9,6 @@ export function createmockclaims(): any { return { confidence: "Cl.Cm", iss: "UNKNOWN", - consent_required: false, client_id: getOrchToAuthExpectedClientId(), govuk_signin_journey_id: "QOFzoB3o-9gGplMgdT1dJfH4vaI", aud: getOrchToAuthExpectedAudience(), diff --git a/src/components/authorize/types.ts b/src/components/authorize/types.ts index 248363142..6c5f9ad6a 100644 --- a/src/components/authorize/types.ts +++ b/src/components/authorize/types.ts @@ -10,7 +10,6 @@ export interface StartAuthResponse extends DefaultApiResponse { export interface UserSessionInfo { upliftRequired: boolean; identityRequired: boolean; - consentRequired: boolean; authenticated: boolean; cookieConsent?: string; gaCrossDomainTrackingId?: string; diff --git a/src/components/common/mfa/send-mfa-controller.ts b/src/components/common/mfa/send-mfa-controller.ts index 1f12fd35b..6429d189b 100644 --- a/src/components/common/mfa/send-mfa-controller.ts +++ b/src/components/common/mfa/send-mfa-controller.ts @@ -57,7 +57,6 @@ export function sendMfaGeneric( { isLatestTermsAndConditionsAccepted: req.session.user.isLatestTermsAndConditionsAccepted, - isConsentRequired: req.session.user.isConsentRequired, isIdentityRequired: req.session.user.isIdentityRequired, }, sessionId diff --git a/src/components/common/state-machine/state-machine.ts b/src/components/common/state-machine/state-machine.ts index 89f2729ac..f3145c203 100644 --- a/src/components/common/state-machine/state-machine.ts +++ b/src/components/common/state-machine/state-machine.ts @@ -63,7 +63,6 @@ const authStateMachine = createMachine( initial: PATH_NAMES.AUTHORIZE, context: { isLatestTermsAndConditionsAccepted: true, - isConsentRequired: false, requiresUplift: false, requiresTwoFactorAuth: false, isAuthenticated: false, @@ -101,10 +100,6 @@ const authStateMachine = createMachine( cond: "requiresAuthAppUplift", }, { target: [PATH_NAMES.UPLIFT_JOURNEY], cond: "requiresUplift" }, - { - target: [PATH_NAMES.SHARE_INFO], - cond: "isConsentRequired", - }, { target: [PATH_NAMES.ENTER_EMAIL_SIGN_IN], cond: "isReauthenticationRequired", @@ -232,10 +227,6 @@ const authStateMachine = createMachine( target: [PATH_NAMES.UPDATED_TERMS_AND_CONDITIONS], cond: "isLatestTermsAndConditionsAccepted", }, - { - target: [PATH_NAMES.SHARE_INFO], - cond: "isConsentRequired", - }, { target: [PATH_NAMES.AUTH_CODE] }, ], }, @@ -328,10 +319,6 @@ const authStateMachine = createMachine( target: [PATH_NAMES.PROVE_IDENTITY], cond: "isIdentityRequired", }, - { - target: [PATH_NAMES.SHARE_INFO], - cond: "isConsentRequired", - }, { target: [PATH_NAMES.CREATE_ACCOUNT_SUCCESSFUL] }, ], }, @@ -350,10 +337,6 @@ const authStateMachine = createMachine( [PATH_NAMES.CREATE_ACCOUNT_SUCCESSFUL]: { on: { [USER_JOURNEY_EVENTS.ACCOUNT_CREATED]: [ - { - target: [PATH_NAMES.SHARE_INFO], - cond: "isConsentRequired", - }, { target: [PATH_NAMES.AUTH_CODE] }, ], }, @@ -389,10 +372,6 @@ const authStateMachine = createMachine( target: [PATH_NAMES.UPDATED_TERMS_AND_CONDITIONS], cond: "isLatestTermsAndConditionsAccepted", }, - { - target: [PATH_NAMES.SHARE_INFO], - cond: "isConsentRequired", - }, { target: [PATH_NAMES.AUTH_CODE] }, ], }, @@ -417,10 +396,6 @@ const authStateMachine = createMachine( target: [PATH_NAMES.PROVE_IDENTITY], cond: "isIdentityRequired", }, - { - target: [PATH_NAMES.SHARE_INFO], - cond: "isConsentRequired", - }, { target: [PATH_NAMES.AUTH_CODE] }, ], [USER_JOURNEY_EVENTS.CHANGE_SECURITY_CODES_REQUESTED]: [ @@ -448,10 +423,6 @@ const authStateMachine = createMachine( target: [PATH_NAMES.PROVE_IDENTITY], cond: "isIdentityRequired", }, - { - target: [PATH_NAMES.SHARE_INFO], - cond: "isConsentRequired", - }, { target: [PATH_NAMES.AUTH_CODE] }, ], }, @@ -475,19 +446,10 @@ const authStateMachine = createMachine( target: [PATH_NAMES.PROVE_IDENTITY], cond: "isIdentityRequired", }, - { - target: [PATH_NAMES.SHARE_INFO], - cond: "isConsentRequired", - }, { target: [PATH_NAMES.AUTH_CODE] }, ], }, }, - [PATH_NAMES.SHARE_INFO]: { - on: { - [USER_JOURNEY_EVENTS.CONSENT_ACCEPTED]: [PATH_NAMES.AUTH_CODE], - }, - }, [PATH_NAMES.RESET_PASSWORD_REQUEST]: { on: { [USER_JOURNEY_EVENTS.PASSWORD_RESET_REQUESTED]: [ @@ -585,10 +547,6 @@ const authStateMachine = createMachine( target: [PATH_NAMES.UPDATED_TERMS_AND_CONDITIONS], cond: "isLatestTermsAndConditionsAccepted", }, - { - target: [PATH_NAMES.SHARE_INFO], - cond: "isConsentRequired", - }, { target: [PATH_NAMES.PROVE_IDENTITY], cond: "isIdentityRequired", @@ -634,10 +592,6 @@ const authStateMachine = createMachine( target: [PATH_NAMES.UPDATED_TERMS_AND_CONDITIONS], cond: "isLatestTermsAndConditionsAccepted", }, - { - target: [PATH_NAMES.SHARE_INFO], - cond: "isConsentRequired", - }, { target: [PATH_NAMES.AUTH_CODE] }, ], }, @@ -767,7 +721,6 @@ const authStateMachine = createMachine( }, { guards: { - isConsentRequired: (context) => context.isConsentRequired === true, isLatestTermsAndConditionsAccepted: (context) => context.isLatestTermsAndConditionsAccepted === false, requiresUplift: (context) => diff --git a/src/components/common/verify-code/verify-code-controller.ts b/src/components/common/verify-code/verify-code-controller.ts index ec33d3148..ac083c55a 100644 --- a/src/components/common/verify-code/verify-code-controller.ts +++ b/src/components/common/verify-code/verify-code-controller.ts @@ -141,7 +141,6 @@ export function verifyCodePost( nextEvent, { isIdentityRequired: req.session.user.isIdentityRequired, - isConsentRequired: req.session.user.isConsentRequired, isLatestTermsAndConditionsAccepted: req.session.user.isLatestTermsAndConditionsAccepted, support2FABeforePasswordReset: support2FABeforePasswordReset(), diff --git a/src/components/create-password/create-password-controller.ts b/src/components/create-password/create-password-controller.ts index ad3b29768..53c267536 100644 --- a/src/components/create-password/create-password-controller.ts +++ b/src/components/create-password/create-password-controller.ts @@ -39,8 +39,6 @@ export function createPasswordPost( throw new BadRequestError(result.data.message, result.data.code); } - req.session.user.isConsentRequired = result.data.consentRequired; - return res.redirect( await getNextPathAndUpdateJourney( req, diff --git a/src/components/create-password/create-password-service.ts b/src/components/create-password/create-password-service.ts index d63fae80a..91ec82a22 100644 --- a/src/components/create-password/create-password-service.ts +++ b/src/components/create-password/create-password-service.ts @@ -5,8 +5,8 @@ import { http, } from "../../utils/http"; import { API_ENDPOINTS } from "../../app.constants"; -import { CreatePasswordServiceInterface, SignUpResponse } from "./types"; -import { ApiResponseResult } from "../../types"; +import { CreatePasswordServiceInterface } from "./types"; +import { ApiResponseResult, DefaultApiResponse } from "../../types"; import { Request } from "express"; export function createPasswordService( @@ -20,8 +20,8 @@ export function createPasswordService( sourceIp: string, persistentSessionId: string, req: Request - ): Promise> { - const response = await axios.client.post( + ): Promise> { + const response = await axios.client.post( API_ENDPOINTS.SIGNUP_USER, { email: emailAddress, @@ -39,7 +39,7 @@ export function createPasswordService( ) ); - return createApiResponse(response); + return createApiResponse(response); }; return { diff --git a/src/components/create-password/tests/create-password-controller.test.ts b/src/components/create-password/tests/create-password-controller.test.ts index 7c140f10f..592b74b84 100644 --- a/src/components/create-password/tests/create-password-controller.test.ts +++ b/src/components/create-password/tests/create-password-controller.test.ts @@ -36,9 +36,6 @@ describe("create-password controller", () => { it("should redirect to get security codes when 2 factor is required", async () => { const fakeService: CreatePasswordServiceInterface = { signUpUser: sinon.fake.returns({ - data: { - consentRequired: false, - }, success: true, }), } as unknown as CreatePasswordServiceInterface; diff --git a/src/components/create-password/types.ts b/src/components/create-password/types.ts index f25431ecd..8b8c9a8cb 100644 --- a/src/components/create-password/types.ts +++ b/src/components/create-password/types.ts @@ -10,9 +10,5 @@ export interface CreatePasswordServiceInterface { sourceIp: string, persistentSessionId: string, req: Request - ) => Promise>; -} - -export interface SignUpResponse extends DefaultApiResponse { - consentRequired: boolean; + ) => Promise>; } diff --git a/src/components/enter-authenticator-app-code/enter-authenticator-app-code-controller.ts b/src/components/enter-authenticator-app-code/enter-authenticator-app-code-controller.ts index 7d4357369..25e03b31f 100644 --- a/src/components/enter-authenticator-app-code/enter-authenticator-app-code-controller.ts +++ b/src/components/enter-authenticator-app-code/enter-authenticator-app-code-controller.ts @@ -156,7 +156,6 @@ export const enterAuthenticatorAppCodePost = ( USER_JOURNEY_EVENTS.AUTH_APP_CODE_VERIFIED, { isIdentityRequired: req.session.user.isIdentityRequired, - isConsentRequired: req.session.user.isConsentRequired, isLatestTermsAndConditionsAccepted: req.session.user.isLatestTermsAndConditionsAccepted, }, diff --git a/src/components/enter-password/enter-password-controller.ts b/src/components/enter-password/enter-password-controller.ts index b871cdc58..a7b65e7cb 100644 --- a/src/components/enter-password/enter-password-controller.ts +++ b/src/components/enter-password/enter-password-controller.ts @@ -157,7 +157,6 @@ export function enterPasswordPost( const isPasswordChangeRequired = userLogin.data.passwordChangeRequired; req.session.user.redactedPhoneNumber = userLogin.data.redactedPhoneNumber; - req.session.user.isConsentRequired = userLogin.data.consentRequired; req.session.user.isAccountPartCreated = !userLogin.data.mfaMethodVerified; req.session.user.isLatestTermsAndConditionsAccepted = userLogin.data.latestTermsAndConditionsAccepted; @@ -248,7 +247,6 @@ export function enterPasswordPost( isLatestTermsAndConditionsAccepted: req.session.user.isLatestTermsAndConditionsAccepted, requiresTwoFactorAuth: userLogin.data.mfaRequired, - isConsentRequired: req.session.user.isConsentRequired, mfaMethodType: userLogin.data.mfaMethodType, isMfaMethodVerified: userLogin.data.mfaMethodVerified, isPasswordChangeRequired: isPasswordChangeRequired, diff --git a/src/components/enter-password/tests/enter-password-controller.test.ts b/src/components/enter-password/tests/enter-password-controller.test.ts index c0146c04f..dfe30fbd6 100644 --- a/src/components/enter-password/tests/enter-password-controller.test.ts +++ b/src/components/enter-password/tests/enter-password-controller.test.ts @@ -57,7 +57,6 @@ describe("enter password controller", () => { data: { redactedPhoneNumber: "3456", mfaRequired: true, - consentRequired: false, latestTermsAndConditionsAccepted: true, mfaMethodVerified: true, mfaMethodType: "SMS", @@ -88,7 +87,6 @@ describe("enter password controller", () => { data: { redactedPhoneNumber: "3456", mfaRequired: true, - consentRequired: false, latestTermsAndConditionsAccepted: true, mfaMethodVerified: true, mfaMethodType: "SMS", @@ -145,7 +143,6 @@ describe("enter password controller", () => { data: { redactedPhoneNumber: "3456", mfaRequired: true, - consentRequired: false, latestTermsAndConditionsAccepted: true, mfaMethodVerified: true, mfaMethodType: "SMS", @@ -198,7 +195,6 @@ describe("enter password controller", () => { data: { redactedPhoneNumber: "3456", mfaRequired: true, - consentRequired: false, latestTermsAndConditionsAccepted: true, mfaMethodVerified: true, mfaMethodType: "SMS", @@ -316,7 +312,6 @@ describe("enter password controller", () => { data: { redactedPhoneNumber: "3456", mfaRequired: true, - consentRequired: false, latestTermsAndConditionsAccepted: true, mfaMethodVerified: true, mfaMethodType: "SMS", diff --git a/src/components/enter-password/types.ts b/src/components/enter-password/types.ts index ff9df5e02..3c5b596a6 100644 --- a/src/components/enter-password/types.ts +++ b/src/components/enter-password/types.ts @@ -6,7 +6,6 @@ export interface UserLoginResponse extends DefaultApiResponse { redactedPhoneNumber?: string; mfaRequired?: boolean; latestTermsAndConditionsAccepted?: boolean; - consentRequired?: boolean; mfaMethodType?: string; mfaMethodVerified?: boolean; passwordChangeRequired?: boolean; diff --git a/src/components/landing/types.ts b/src/components/landing/types.ts index 42002be96..6fbd14576 100644 --- a/src/components/landing/types.ts +++ b/src/components/landing/types.ts @@ -19,7 +19,6 @@ export interface ClientInfo { export interface UserSessionInfo { upliftRequired: boolean; identityRequired: boolean; - consentRequired: boolean; authenticated: boolean; cookieConsent?: string; gaCrossDomainTrackingId?: string; diff --git a/src/components/reset-password/reset-password-controller.ts b/src/components/reset-password/reset-password-controller.ts index 9b64724f3..78a3ff38c 100644 --- a/src/components/reset-password/reset-password-controller.ts +++ b/src/components/reset-password/reset-password-controller.ts @@ -114,7 +114,6 @@ export function resetPasswordPost( req.session.user.redactedPhoneNumber = loginResponse.data.redactedPhoneNumber; - req.session.user.isConsentRequired = loginResponse.data.consentRequired; req.session.user.isLatestTermsAndConditionsAccepted = loginResponse.data.latestTermsAndConditionsAccepted; req.session.user.isAccountPartCreated = @@ -158,7 +157,6 @@ export function resetPasswordPost( USER_JOURNEY_EVENTS.PASSWORD_CREATED, { isIdentityRequired: req.session.user.isIdentityRequired, - isConsentRequired: req.session.user.isConsentRequired, requiresTwoFactorAuth: !support2FABeforePasswordReset(), isLatestTermsAndConditionsAccepted: req.session.user.isLatestTermsAndConditionsAccepted, diff --git a/src/components/reset-password/tests/reset-password-controller.test.ts b/src/components/reset-password/tests/reset-password-controller.test.ts index 954497c68..e995ee28e 100644 --- a/src/components/reset-password/tests/reset-password-controller.test.ts +++ b/src/components/reset-password/tests/reset-password-controller.test.ts @@ -100,7 +100,6 @@ describe("reset password controller (in 6 digit code flow)", () => { success: true, data: { redactedPhoneNumber: "1234", - consentRequired: false, latestTermsAndConditionsAccepted: true, mfaMethodVerified: true, mfaMethodType: MFA_METHOD_TYPE.SMS, @@ -154,7 +153,6 @@ describe("reset password controller (in 6 digit code flow)", () => { success: true, data: { redactedPhoneNumber: "1234", - consentRequired: false, latestTermsAndConditionsAccepted: true, mfaMethodVerified: true, mfaMethodType: MFA_METHOD_TYPE.SMS, @@ -189,7 +187,6 @@ describe("reset password controller (in 6 digit code flow)", () => { success: true, data: { redactedPhoneNumber: "1234", - consentRequired: false, latestTermsAndConditionsAccepted: true, mfaMethodVerified: false, mfaRequired: true, @@ -233,7 +230,6 @@ describe("reset password controller (in 6 digit code flow)", () => { success: true, data: { redactedPhoneNumber: "1234", - consentRequired: false, latestTermsAndConditionsAccepted: true, mfaMethodVerified: true, mfaRequired: false, @@ -277,7 +273,6 @@ describe("reset password controller (in 6 digit code flow)", () => { success: true, data: { redactedPhoneNumber: "1234", - consentRequired: false, latestTermsAndConditionsAccepted: true, mfaMethodVerified: true, mfaRequired: false, diff --git a/src/components/share-info/index.njk b/src/components/share-info/index.njk deleted file mode 100644 index 505570cf5..000000000 --- a/src/components/share-info/index.njk +++ /dev/null @@ -1,66 +0,0 @@ -{% extends "common/layout/base.njk" %} -{% from "govuk/components/button/macro.njk" import govukButton %} -{% from "govuk/components/radios/macro.njk" import govukRadios %} - -{% set pageTitleName = 'pages.shareInfo.title' | translate %} - -{% block content %} - -

- {{ 'pages.shareInfo.header' | translate }} -

- -

{{ clientName }}

-

{{'pages.shareInfo.bulletPointSectionHeader' | translate}}

- -
    - {% for scope in prettyScopes %} -
  • - {{ scope }} -
  • - {% endfor %} -
- -

{{'pages.shareInfo.paragraph1' | translate}}

-

{{'pages.shareInfo.paragraph2' | translate}}

-

{{'pages.shareInfo.paragraph3' | translate}}

- -
- - - -{{ govukRadios({ - name: "consentValue", - fieldset: { - legend: { - text: 'pages.shareInfo.essentialHeader' | translate, - isPageHeading: false, - classes: "govuk-fieldset__legend--s" - } - }, - items: [ - { - text: 'pages.shareInfo.radios.radioText.agree' | translate, - value: "true" - }, - { - text: 'pages.shareInfo.radios.radioText.doNotAgree' | translate, - value: "false" - } - ], - errorMessage: { - text: errors['consentValue'].text - } if (errors['consentValue']) -}) }} - -{{ govukButton({ - "text": 'pages.shareInfo.continue' | translate, - "type": "Submit", - "preventDoubleClick": true -}) }} - -
- -{{ga4OnPageLoad({ nonce: scriptNonce, statusCode: "200", englishPageTitle: pageTitleName, taxonomyLevel1: "authentication", taxonomyLevel2: "", contentId: "", loggedInStatus: false, dynamic: false })}} - -{% endblock %} diff --git a/src/components/share-info/share-info-controller.ts b/src/components/share-info/share-info-controller.ts deleted file mode 100644 index 0583d4177..000000000 --- a/src/components/share-info/share-info-controller.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { Request, Response } from "express"; -import { ExpressRouteFunc } from "../../types"; - -import { BadRequestError } from "../../utils/error"; -import { - UpdateProfileServiceInterface, - UpdateType, -} from "../common/update-profile/types"; -import { updateProfileService } from "../common/update-profile/update-profile-service"; -import { USER_JOURNEY_EVENTS } from "../common/state-machine/state-machine"; -import { getNextPathAndUpdateJourney } from "../common/constants"; - -export function shareInfoGet(req: Request, res: Response): void { - const prettyScopes = mapScopes(req.session.client.scopes); - - res.render("share-info/index.njk", { - clientName: req.session.client.name, - prettyScopes, - }); -} - -export function shareInfoPost( - service: UpdateProfileServiceInterface = updateProfileService() -): ExpressRouteFunc { - return async function (req: Request, res: Response) { - const consentValue = req.body.consentValue; - const { email } = req.session.user; - const { sessionId, clientSessionId, persistentSessionId } = res.locals; - - const result = await service.updateProfile( - sessionId, - clientSessionId, - email, - { - profileInformation: consentValue, - updateProfileType: UpdateType.CAPTURE_CONSENT, - }, - req.ip, - persistentSessionId, - req - ); - - if (!result.success) { - throw new BadRequestError(result.data.message, result.data.code); - } - - res.redirect( - await getNextPathAndUpdateJourney( - req, - req.path, - USER_JOURNEY_EVENTS.CONSENT_ACCEPTED, - null, - sessionId - ) - ); - }; -} - -function mapScopes(scopes: string[]) { - const returnScopes: string[] = []; - scopes.forEach(function (item) { - if (item === "email") { - returnScopes.push("email address"); - } - if (item === "phone") { - returnScopes.push("phone number"); - } - }); - return returnScopes; -} diff --git a/src/components/share-info/share-info-routes.ts b/src/components/share-info/share-info-routes.ts deleted file mode 100644 index a16965e5a..000000000 --- a/src/components/share-info/share-info-routes.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { PATH_NAMES } from "../../app.constants"; - -import * as express from "express"; -import { shareInfoGet, shareInfoPost } from "./share-info-controller"; -import { validateSessionMiddleware } from "../../middleware/session-middleware"; -import { asyncHandler } from "../../utils/async"; -import { validateShareInfoRequest } from "./share-info-validation"; -import { allowUserJourneyMiddleware } from "../../middleware/allow-user-journey-middleware"; - -const router = express.Router(); - -router.get( - PATH_NAMES.SHARE_INFO, - validateSessionMiddleware, - allowUserJourneyMiddleware, - shareInfoGet -); - -router.post( - PATH_NAMES.SHARE_INFO, - validateSessionMiddleware, - allowUserJourneyMiddleware, - validateShareInfoRequest(), - asyncHandler(shareInfoPost()) -); - -export { router as shareInfoRouter }; diff --git a/src/components/share-info/share-info-validation.ts b/src/components/share-info/share-info-validation.ts deleted file mode 100644 index 1f9592524..000000000 --- a/src/components/share-info/share-info-validation.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { body } from "express-validator"; -import { validateBodyMiddleware } from "../../middleware/form-validation-middleware"; -import { ValidationChainFunc } from "../../types"; - -export function validateShareInfoRequest(): ValidationChainFunc { - return [ - body("consentValue") - .notEmpty() - .withMessage((value, { req }) => { - return req.t("pages.shareInfo.radios.radioText.errorMessage", { - value, - }); - }), - validateBodyMiddleware("share-info/index.njk"), - ]; -} diff --git a/src/components/share-info/tests/share-info-controller.test.ts b/src/components/share-info/tests/share-info-controller.test.ts deleted file mode 100644 index 6690585cd..000000000 --- a/src/components/share-info/tests/share-info-controller.test.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { expect } from "chai"; -import { describe } from "mocha"; -import { sinon } from "../../../../test/utils/test-utils"; -import { Request, Response } from "express"; -import { shareInfoGet, shareInfoPost } from "../share-info-controller"; - -import { BadRequestError } from "../../../utils/error"; -import { UpdateProfileServiceInterface } from "../../common/update-profile/types"; -import { PATH_NAMES } from "../../../app.constants"; -import { mockResponse, RequestOutput, ResponseOutput } from "mock-req-res"; -import { createMockRequest } from "../../../../test/helpers/mock-request-helper"; -import { commonVariables } from "../../../../test/helpers/common-test-variables"; - -describe("share-info controller", () => { - let req: RequestOutput; - let res: ResponseOutput; - - beforeEach(() => { - req = createMockRequest(PATH_NAMES.SHARE_INFO); - req.session.client = { - name: "clientname", - scopes: ["openid", "email", "phone"], - }; - req.session.user.email = commonVariables.email; - res = mockResponse(); - }); - - afterEach(() => { - sinon.restore(); - }); - - describe("shareInfoGet", () => { - it("should render share-info page", () => { - shareInfoGet(req as Request, res as Response); - - expect(res.render).to.have.calledWith("share-info/index.njk"); - }); - }); - - describe("shareInfoPost", () => { - it("should redirect to /auth-code when accepted sharing info", async () => { - const fakeService: UpdateProfileServiceInterface = { - updateProfile: sinon.fake.returns({ - success: true, - }), - } as unknown as UpdateProfileServiceInterface; - - req.body.consentValue = true; - - await shareInfoPost(fakeService)(req as Request, res as Response); - - expect(fakeService.updateProfile).to.have.been.calledOnce; - expect(res.redirect).to.have.calledWith(PATH_NAMES.AUTH_CODE); - }); - }); - - describe("shareInfoPostError", () => { - it("should throw error when update profile returns false", async () => { - const fakeService: UpdateProfileServiceInterface = { - updateProfile: sinon.fake.returns({ - success: false, - data: { code: "1000", message: "error" }, - }), - } as unknown as UpdateProfileServiceInterface; - - req.body.consentValue = true; - - await expect( - shareInfoPost(fakeService)(req as Request, res as Response) - ).to.be.rejectedWith(BadRequestError, "1000:error"); - - expect(fakeService.updateProfile).to.have.been.calledOnce; - }); - }); -}); diff --git a/src/components/share-info/tests/share-info-integration.test.ts b/src/components/share-info/tests/share-info-integration.test.ts deleted file mode 100644 index b4c5d959e..000000000 --- a/src/components/share-info/tests/share-info-integration.test.ts +++ /dev/null @@ -1,130 +0,0 @@ -import request from "supertest"; -import { describe } from "mocha"; -import { expect, sinon } from "../../../../test/utils/test-utils"; -import nock = require("nock"); -import * as cheerio from "cheerio"; -import decache from "decache"; -import { - API_ENDPOINTS, - HTTP_STATUS_CODES, - PATH_NAMES, -} from "../../../app.constants"; - -describe("Integration::share info", () => { - let token: string | string[]; - let cookies: string; - let app: any; - let baseApi: string; - - before(async () => { - decache("../../../app"); - decache("../../../middleware/session-middleware"); - const sessionMiddleware = require("../../../middleware/session-middleware"); - - sinon - .stub(sessionMiddleware, "validateSessionMiddleware") - .callsFake(function (req: any, res: any, next: any): void { - res.locals.sessionId = "tDy103saszhcxbQq0-mjdzU854"; - res.locals.clientSessionId = "csy103saszhcxbQq0-mjdzU854"; - res.locals.persistentSessionId = "dips-123456-abc"; - - req.session.user = { - email: "test@test.com", - journey: { - nextPath: PATH_NAMES.SHARE_INFO, - }, - }; - - req.session.client = { - name: "clientname", - scopes: ["openid", "email", "phone"], - }; - - next(); - }); - - app = await require("../../../app").createApp(); - baseApi = process.env.FRONTEND_API_BASE_URL; - - request(app) - .get(PATH_NAMES.SHARE_INFO) - .end((err, res) => { - const $ = cheerio.load(res.text); - token = $("[name=_csrf]").val(); - cookies = res.headers["set-cookie"]; - }); - }); - - beforeEach(() => { - nock.cleanAll(); - }); - - after(() => { - sinon.restore(); - app = undefined; - }); - - it("should return share info page", (done) => { - request(app).get(PATH_NAMES.SHARE_INFO).expect(200, done); - }); - - it("should return error when csrf not present", (done) => { - request(app) - .post(PATH_NAMES.SHARE_INFO) - .type("form") - .send({ - consentValue: "true", - }) - .expect(500, done); - }); - - it("should return validation error when consentValue not selected", (done) => { - request(app) - .post(PATH_NAMES.SHARE_INFO) - .type("form") - .set("Cookie", cookies) - .send({ - _csrf: token, - consentValue: undefined, - }) - .expect(function (res) { - const $ = cheerio.load(res.text); - expect($("#consentValue-error").text()).to.contains( - "Select if you want to share your email address and phone number or not" - ); - }) - .expect(400, done); - }); - - it("should redirect to /auth-code page when consentValue valid", (done) => { - nock(baseApi) - .post(API_ENDPOINTS.UPDATE_PROFILE) - .once() - .reply(HTTP_STATUS_CODES.NO_CONTENT); - - request(app) - .post(PATH_NAMES.SHARE_INFO) - .type("form") - .set("Cookie", cookies) - .send({ - _csrf: token, - consentValue: "true", - }) - .expect("Location", PATH_NAMES.AUTH_CODE) - .expect(302, done); - }); - - it("should return internal server error when /update-profile API call response is 500", (done) => { - nock(baseApi).post(API_ENDPOINTS.UPDATE_PROFILE).once().reply(500, {}); - - request(app) - .post(PATH_NAMES.SHARE_INFO) - .type("form") - .set("Cookie", cookies) - .send({ - _csrf: token, - consentValue: "true", - }) - .expect(500, done); - }); -}); diff --git a/src/components/updated-terms-conditions/tests/updated-terms-conditions.test.ts b/src/components/updated-terms-conditions/tests/updated-terms-conditions.test.ts index 0eed7fe9f..eebb562cf 100644 --- a/src/components/updated-terms-conditions/tests/updated-terms-conditions.test.ts +++ b/src/components/updated-terms-conditions/tests/updated-terms-conditions.test.ts @@ -61,27 +61,6 @@ describe("updated terms conditions controller", () => { expect(res.redirect).to.have.been.calledWith(PATH_NAMES.AUTH_CODE); }); - it("should redirect to /share-info when consent required", async () => { - const fakeService: UpdateProfileServiceInterface = { - updateProfile: sinon.fake.returns({ - success: true, - }), - } as unknown as UpdateProfileServiceInterface; - - req.path = PATH_NAMES.UPDATED_TERMS_AND_CONDITIONS; - req.session.client.consentEnabled = true; - req.session.user.isConsentRequired = true; - req.body.termsAndConditionsResult = "accept"; - - await updatedTermsConditionsPost(fakeService)( - req as Request, - res as Response - ); - - expect(fakeService.updateProfile).to.have.been.calledOnce; - expect(res.redirect).to.have.calledWith(PATH_NAMES.SHARE_INFO); - }); - it("should redirect to govUK website when termsAndConditionsResult has value govUk", async () => { const fakeService: UpdateProfileServiceInterface = { updateProfile: sinon.fake(), diff --git a/src/components/updated-terms-conditions/updated-terms-conditions-controller.ts b/src/components/updated-terms-conditions/updated-terms-conditions-controller.ts index 73099cab2..06b1834b1 100644 --- a/src/components/updated-terms-conditions/updated-terms-conditions-controller.ts +++ b/src/components/updated-terms-conditions/updated-terms-conditions-controller.ts @@ -61,7 +61,6 @@ export function updatedTermsConditionsPost( req.path, USER_JOURNEY_EVENTS.TERMS_AND_CONDITIONS_ACCEPTED, { - isConsentRequired: req.session.user.isConsentRequired, isIdentityRequired: req.session.user.isIdentityRequired, }, sessionId diff --git a/src/locales/cy/translation.json b/src/locales/cy/translation.json index 08413fb9e..6c08b8495 100644 --- a/src/locales/cy/translation.json +++ b/src/locales/cy/translation.json @@ -669,24 +669,6 @@ "signInLinkText": "mewngofnodwch", "paragraph2": "i’ch GOV.UK One Login." }, - "shareInfo": { - "title": "Rhannu gwybodaeth o’ch GOV.UK One Login", - "header": "Rhannu gwybodaeth o’ch GOV.UK One Login", - "continue": "Parhau", - "bulletPointSectionHeader": "Mae’r gwasanaeth hwn angen defnyddio eich:", - "paragraph1": "Rydych wedi ychwanegu’r wybodaeth hon i’ch GOV.UK One Login pan wnaethoch ei greu. Gallwch ddewis ei rannu gyda’r gwasanaeth yn lle ei roi i mewn eto pan fyddwch yn defnyddio’r gwasanaeth.", - "paragraph2": "Bydd y gwasanaeth ond yn defnyddio’r wybodaeth yma i gysylltu â chi am y gwasanaeth. Ni fydd yn rhannu eich gwybodaeth ag unrhyw un arall. Bydd yn cadw eich gwybodaeth cyhyd ag y mae ei angen neu mae’r gyfraith yn ei gwneud yn ofynnol iddo.", - "paragraph3": "Os ydych yn dewis peidio â rhannu gwybodaeth o’ch GOV.UK One Login,efallai y gofynnir i chi am y wybodaeth honno o hyd wrth i chi ddefnyddio’r gwasanaeth. Er enghraifft os ydych yn dewis peidio â rhannu eich cyfeiriad e-bost a’ch rhif ffôn ac mae’r gwasanaeth angen ffordd i gysylltu â chi.", - "essentialHeader": "Ydych chi eisiau rhannu gwybodaeth o’ch GOV.UK One Login? ", - "radios": { - "shareMy": "Ydych chi eisiau rhannu gwybodaeth o’ch GOV.UK One Login?", - "radioText": { - "agree": "Rhannwch fy nghyfeiriad e-bost a’m rhif ffôn", - "doNotAgree": "Peidiwch rhannu fy nghyfeiriad e-bost â’m rhif ffôn", - "errorMessage": "Dewiswch os ydych am rannu eich cyfeiriad e-bost a’ch rhif ffôn neu beidio" - } - } - }, "updatedTermsAndConds": { "title": "Diweddariad telerau defnyddio GOV.UK One Login", "header": "Diweddariad telerau defnyddio GOV.UK One Login", diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index e6936ba81..7a8f54bd6 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -669,24 +669,6 @@ "signInLinkText": "sign in", "paragraph2": "to your GOV.UK One Login." }, - "shareInfo": { - "title": "Share information from your GOV.UK One Login", - "header": "Share information from your GOV.UK One Login", - "continue": "Continue", - "bulletPointSectionHeader": "This service needs to use your:", - "paragraph1": "You added this information to your GOV.UK One Login when you created it. You can choose to share the information with the service instead of entering it again when you use the service.", - "paragraph2": "The service will only use this information to contact you about the service. It won’t share your information with anyone else. It will keep your information for as long as it needs to or the law requires it to.", - "paragraph3": "If you choose not to share information from your GOV.UK One Login, you may still be asked for that information as you use the service. For example if you choose not to share your email address and phone number and the service needs a way to contact you.", - "essentialHeader": "Do you want to share information from your GOV.UK One Login? ", - "radios": { - "shareMy": "Do you want to share information from your GOV.UK One Login?", - "radioText": { - "agree": "Share my email address and phone number", - "doNotAgree": "Do not share my email address and phone number", - "errorMessage": "Select if you want to share your email address and phone number or not" - } - } - }, "updatedTermsAndConds": { "title": "GOV.UK One Login terms of use update", "header": "GOV.UK One Login terms of use update", diff --git a/src/types.ts b/src/types.ts index 98067a35a..07307c726 100644 --- a/src/types.ts +++ b/src/types.ts @@ -55,7 +55,6 @@ export interface UserSession { redactedPhoneNumber?: string; phoneNumber?: string; journey?: { nextPath: string; optionalPaths: string[] }; - isConsentRequired?: boolean; isLatestTermsAndConditionsAccepted?: boolean; isIdentityRequired?: boolean; isUpliftRequired?: boolean; @@ -91,7 +90,6 @@ export interface UserSessionClient { name?: string; serviceType?: string; cookieConsentEnabled?: boolean; - consentEnabled?: boolean; crossDomainGaTrackingId?: string; scopes?: string[]; prompt?: string;