Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/post-deploy-tests/ma…
Browse files Browse the repository at this point in the history
…in/dev-dependencies-1bd01367a4
  • Loading branch information
latifcabinetoffice authored Sep 23, 2024
2 parents 7b8d8f5 + 5aefbe1 commit 895ef9d
Show file tree
Hide file tree
Showing 11 changed files with 797 additions and 804 deletions.
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
1,510 changes: 750 additions & 760 deletions package-lock.json

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,43 +47,43 @@
},
"dependencies": {
"@aws-crypto/client-node": "^4.0.1",
"@aws-sdk/client-dynamodb": "^3.637.0",
"@aws-sdk/client-kms": "^3.637.0",
"@aws-sdk/client-sns": "^3.637.0",
"@aws-sdk/client-sqs": "^3.637.0",
"@aws-sdk/lib-dynamodb": "^3.637.0",
"@aws-sdk/client-dynamodb": "^3.656.0",
"@aws-sdk/client-kms": "^3.654.0",
"@aws-sdk/client-sns": "^3.654.0",
"@aws-sdk/client-sqs": "^3.654.0",
"@aws-sdk/lib-dynamodb": "^3.656.0",
"@aws-sdk/util-dynamodb": "^3.609.0",
"@govuk-one-login/frontend-analytics": "2.0.1",
"@govuk-one-login/frontend-language-toggle": "^1.1.0",
"axios": "^1.7.5",
"axios": "^1.7.7",
"base64url": "3.0.1",
"body-parser": "^1.20.2",
"body-parser": "^1.20.3",
"connect-dynamodb": "^3.0.3",
"cookie-parser": "^1.4.6",
"csurf": "^1.11.0",
"dompurify": "^3.1.6",
"express": "^4.19.2",
"express": "^4.21.0",
"express-session": "^1.18.0",
"express-validator": "^7.2.0",
"fast-memoize": "^2.5.2",
"govuk-frontend": "^4.8.0",
"helmet": "7.1.0",
"i18next": "^23.14.0",
"i18next": "^23.15.1",
"i18next-fs-backend": "^2.3.2",
"i18next-http-middleware": "^3.6.0",
"jose": "^5.8.0",
"jsdom": "^25.0.0",
"libphonenumber-js": "^1.11.7",
"jose": "^5.9.3",
"jsdom": "^25.0.1",
"libphonenumber-js": "^1.11.9",
"nunjucks": "^3.2.4",
"openid-client": "^5.6.5",
"openid-client": "^5.7.0",
"otplib": "^12.0.1",
"pino": "^9.3.2",
"pino-http": "^10.2.0",
"pino": "^9.4.0",
"pino-http": "^10.3.0",
"prettier": "^3.3.3",
"qrcode": "^1.5.4",
"uuid": "^10.0.0",
"xss": "^1.0.15",
"xstate": "^5.17.4"
"xstate": "^5.18.2"
},
"devDependencies": {
"@eslint/js": "^9.9.1",
Expand Down
6 changes: 3 additions & 3 deletions src/app.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const PATH_DATA: Record<
type: UserJourney.AddMfaMethod,
},
ADD_MFA_METHOD_APP_CONFIRMATION: {
url: "/add-mfa-method-app-confirmation",
url: "/backup-auth-app-confirmation",
event: EventType.Confirmation,
type: UserJourney.AddMfaMethod,
},
Expand All @@ -33,7 +33,7 @@ export const PATH_DATA: Record<
type: UserJourney.AddMfaMethod,
},
ADD_MFA_METHOD_SMS_CONFIRMATION: {
url: "/add-mfa-method-sms-confirmation",
url: "/backup-text-message-confirmation",
event: EventType.Confirmation,
type: UserJourney.ChangePhoneNumber,
},
Expand Down Expand Up @@ -63,7 +63,7 @@ export const PATH_DATA: Record<
event: EventType.ValueUpdated,
},
SWITCH_BACKUP_METHOD_CONFIRMATION: {
url: "/switch-method-confirm",
url: "/switch-methods-confirmation",
type: UserJourney.SwitchBackupMethod,
event: EventType.Confirmation,
},
Expand Down
2 changes: 2 additions & 0 deletions src/components/common/confirmation-page/confirmation.njk
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% extends "common/layout/base-page.njk" %}
{% from "govuk/components/panel/macro.njk" import govukPanel %}
{% block backLinkBlock %}
{% endblock %}
{% block pageContent %}
{{ govukPanel({
titleText: heading
Expand Down
2 changes: 2 additions & 0 deletions src/components/common/layout/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@
})
}}
{% endif %}
{% block backLinkBlock %}
{% if backLink %}
<a href="{{backLink}}" class="govuk-back-link js-back-link">
{{ backLinkText }}
{{'general.back' | translate if not backLinkText}}
</a>
{% endif %}
{% endblock %}
{% block beforeContent %}{% endblock %}

<main class="govuk-main-wrapper {{ mainClasses }}" id="main-content" role="main" {% if mainLang %} lang="{{ mainLang }}" {% endif %}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,5 @@ export async function deleteMfaMethodPost(

req.session.removedMfaMethods = [methodToRemove];

res.redirect(
`${PATH_DATA.DELETE_MFA_METHOD_CONFIRMATION.url}?id=${methodToRemove.mfaIdentifier}`
);
res.redirect(`${PATH_DATA.DELETE_MFA_METHOD_CONFIRMATION.url}`);
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe("delete mfa method controller", () => {
await deleteMfaMethodPost(req as Request, res as Response);

expect(removeFn).to.be.calledWith(1);
expect(redirectFn).to.be.calledWith("/remove-backup-confirmation?id=1");
expect(redirectFn).to.be.calledWith("/remove-backup-confirmation");
});

it("should return a 404 if a non existant method is tried", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe("change default method", () => {
await switchBackupMfaMethodPost(req as Request, res as Response);

expect(changeFn).to.be.calledWith(1);
expect(redirectFn).to.be.calledWith("/switch-method-confirm");
expect(redirectFn).to.be.calledWith("/switch-methods-confirmation");
});

it("should return a 404 if the new defualt method doesn't exist", async () => {
Expand Down
32 changes: 16 additions & 16 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,23 +259,23 @@
"confirm": {
"title": "Add back-up phone number",
"heading": "You've added a back-up method for getting security codes",
"message": "If your default method for getting security codes is not available, you can get a code to your phone number ending in [mobile] instead",
"message": "If your default method for getting security codes is not available, you can get a code to your phone number ending with [mobile] instead.",
"backLink": "Back to Security"
}
},
"removeBackupMethod": {
"title": "Remove your back-up method for getting security codes",
"paragraph": "This will delete your back-up method for getting security codes.",
"sms": "We'll no longer send security codes by text message to your phone number ending in <strong>[phoneNumber]</strong>",
"app": "We'll no longer send security codes to your authenticator app",
"sms": "We'll no longer send security codes by text message to your phone number ending with <strong>[phoneNumber]</strong>.",
"app": "We'll no longer send security codes to your authenticator app.",
"button": "Remove back-up method",
"backLinkText": "Back to security",
"confirm": {
"title": "You've removed your back-up method for getting security codes",
"heading": "You've removed your back-up method for getting security codes",
"message_app": "You'll no longer get security codes to your authenticator app",
"message_sms": "You'll no longer get security codes to your phone number ending <strong>[phoneNumber]</strong>",
"message_unknown": "You'll no longer get security codes to your backup method"
"heading": "You've removed your back-up method for getting security codes.",
"message_app": "You'll no longer get security codes to your authenticator app.",
"message_sms": "You'll no longer get security codes to your phone number ending <strong>[phoneNumber]</strong>.",
"message_unknown": "You'll no longer get security codes to your backup method."
}
},
"activityHistory": {
Expand Down Expand Up @@ -517,7 +517,7 @@
"checkYourPhone": {
"title": "Check your phone",
"header": "Check your phone",
"text": "We have sent a code to your phone number ending with <strong>[mobile]</strong>",
"text": "We have sent a code to your phone number ending with <strong>[mobile]</strong>.",
"info": {
"paragraph": "It might take a few minutes to arrive. The code will expire after 15 minutes."
},
Expand All @@ -538,7 +538,7 @@
},
"changeDefaultMethod": {
"title": "Use a different default method",
"currentIsPhone": "Your default method for getting security codes is currently by text message to your phone number ending with <strong>[phoneNumber]</strong>",
"currentIsPhone": "Your default method for getting security codes is currently by text message to your phone number ending with <strong>[phoneNumber]</strong>.",
"switchToApp": "You can use an authenticator app instead",
"currentIsApp": "Your default method for getting security codes is currently using your authenticator app",
"switchToPhone": "You can get codes by text message instead.",
Expand All @@ -548,7 +548,7 @@
"confirmation": {
"title": "Change default method",
"heading": "You've changed your default method for getting security codes",
"app": "Your default method for getting security codes is now your authenticator app",
"app": "Your default method for getting security codes is now your authenticator app.",
"back": "Back to Security"
}
},
Expand Down Expand Up @@ -608,7 +608,7 @@
"continue": "Get security code",
"message": "Text messages can sometimes take a few minutes to arrive.",
"phoneNumber": {
"insetText": "We will send a code to your phone number ending with <strong>[mobile]</strong>",
"insetText": "We will send a code to your phone number ending with <strong>[mobile]</strong>.",
"paragraph": "Text messages can sometimes take a few minutes to arrive."
},
"email": {
Expand All @@ -619,16 +619,16 @@
"switchBackupMethod": {
"title": "Switch your back-up and default methods",
"newDefaultApp": "Your default method for getting secrity codes will be using your authenticator app.",
"newDefaultSms": "Your default method for getting security codes will be text message to your phone number ending in <strong>[phoneNumber]</strong>",
"newBackupApp": "Your authenticator app will become your back-up method",
"newBackupSms": "Your back-up method will be a text message to your phone number ending in <strong>[phoneNumber]</strong>",
"newDefaultSms": "Your default method for getting security codes will be text messages to your phone number ending with <strong>[phoneNumber]</strong>.",
"newBackupApp": "Your authenticator app will become your back-up method.",
"newBackupSms": "Your back-up method will be a text message to your phone number ending with <strong>[phoneNumber]</strong>.",
"button": "Switch methods",
"confirm": {
"title": "Switch security codes",
"heading": "You've switched your back-up and default methods for getting security codes",
"backLinkText": "Back to Security",
"messageSms": "We'll send security codes to your phone number ending in <strong>[phoneNumber]</strong>",
"messageApp": "You'll use your authenticator app to get security codes to sign in"
"messageSms": "We'll send security codes to your phone number ending with <strong>[phoneNumber]</strong>.",
"messageApp": "You'll use your authenticator app to get security codes to sign in."
}
},
"contact": {
Expand Down
6 changes: 5 additions & 1 deletion src/utils/safeTranslate.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { TFunction, TFunctionDetailedResult } from "i18next";
import { logger } from "./logger";
import { LOCALE } from "../app.constants";
import { $SpecialObject } from "i18next/typescript/helpers";

export type translateResult = string | TFunctionDetailedResult<string, any>;
export type translateResult =
| string
| TFunctionDetailedResult<string, any>
| $SpecialObject;

export const safeTranslate = (
translate: TFunction<"translation", undefined>,
Expand Down

0 comments on commit 895ef9d

Please sign in to comment.