From 48e1454a2372a5ea98cb96fc8d2774c41fcde212 Mon Sep 17 00:00:00 2001 From: GTVJ Date: Fri, 7 Jun 2024 15:31:16 +0100 Subject: [PATCH] AUT-1466: Show end of telephone number on MFA resend screen --- src/components/resend-mfa-code/index.njk | 10 +++------- .../resend-mfa-code/resend-mfa-code-controller.ts | 1 - .../tests/resend-mfa-code-integration.test.ts | 11 ++++++++++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/components/resend-mfa-code/index.njk b/src/components/resend-mfa-code/index.njk index af60efa3e7..3f7f376ab9 100644 --- a/src/components/resend-mfa-code/index.njk +++ b/src/components/resend-mfa-code/index.njk @@ -6,13 +6,9 @@ {% set showBack = true %} {% set hrefBack = 'enter-code' %} -{% if isResendCodeRequest %} - {% set phoneNumberMessage %} - {{ 'pages.resendMfaCode.phoneNumber.isResendCodeRequest' | translate }} {{ phoneNumber }} - {% endset %} -{% else %} - {% set phoneNumberMessage = 'pages.resendMfaCode.phoneNumber.default' | translate | replace("[mobile]", phoneNumber) %} -{% endif %} +{% set phoneNumberMessage %} + {{ 'pages.resendMfaCode.phoneNumber.isResendCodeRequest' | translate }} {{ phoneNumber | returnLastCharacters({limit: 3}) }} +{% endset %} {% block content %}
diff --git a/src/components/resend-mfa-code/resend-mfa-code-controller.ts b/src/components/resend-mfa-code/resend-mfa-code-controller.ts index 41eba789d0..304ecb75c1 100644 --- a/src/components/resend-mfa-code/resend-mfa-code-controller.ts +++ b/src/components/resend-mfa-code/resend-mfa-code-controller.ts @@ -32,7 +32,6 @@ export function resendMfaCodeGet(req: Request, res: Response): void { } else { res.render("resend-mfa-code/index.njk", { phoneNumber: req.session.user.redactedPhoneNumber, - isResendCodeRequest: req.query?.isResendCodeRequest, support2hrLockout: support2hrLockout(), }); } diff --git a/src/components/resend-mfa-code/tests/resend-mfa-code-integration.test.ts b/src/components/resend-mfa-code/tests/resend-mfa-code-integration.test.ts index b33cb46a5d..d845596ce9 100644 --- a/src/components/resend-mfa-code/tests/resend-mfa-code-integration.test.ts +++ b/src/components/resend-mfa-code/tests/resend-mfa-code-integration.test.ts @@ -1,6 +1,6 @@ import request from "supertest"; import { describe } from "mocha"; -import { sinon } from "../../../../test/utils/test-utils"; +import { expect, sinon } from "../../../../test/utils/test-utils"; import nock = require("nock"); import * as cheerio from "cheerio"; import decache from "decache"; @@ -63,6 +63,15 @@ describe("Integration:: resend mfa code", () => { request(app).get(PATH_NAMES.RESEND_MFA_CODE).expect(200, done); }); + it("should include the last 3 digits of the user's telephone number on the resend MFA code page", (done) => { + request(app).get(PATH_NAMES.RESEND_MFA_CODE) + .expect(function (res) { + const $ = cheerio.load(res.text); + expect($(".govuk-inset-text span").text()).to.eq("867"); + }) + .expect(200, done); + }) + it("should return error when csrf not present", (done) => { request(app) .post(PATH_NAMES.RESEND_MFA_CODE)