Skip to content

Commit

Permalink
AUT-1466: Show end of telephone number on MFA resend screen
Browse files Browse the repository at this point in the history
  • Loading branch information
gtvj committed Jun 7, 2024
1 parent 8fd777f commit 48e1454
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
10 changes: 3 additions & 7 deletions src/components/resend-mfa-code/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
{% set showBack = true %}
{% set hrefBack = 'enter-code' %}

{% if isResendCodeRequest %}
{% set phoneNumberMessage %}
{{ 'pages.resendMfaCode.phoneNumber.isResendCodeRequest' | translate }} <span class='govuk-!-font-weight-bold'>{{ phoneNumber }}</span>
{% endset %}
{% else %}
{% set phoneNumberMessage = 'pages.resendMfaCode.phoneNumber.default' | translate | replace("[mobile]", phoneNumber) %}
{% endif %}
{% set phoneNumberMessage %}
{{ 'pages.resendMfaCode.phoneNumber.isResendCodeRequest' | translate }} <span class='govuk-!-font-weight-bold'>{{ phoneNumber | returnLastCharacters({limit: 3}) }}</span>
{% endset %}

{% block content %}
<form action="/resend-code" method="post" novalidate="novalidate">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 48e1454

Please sign in to comment.