Skip to content

Commit 022db74

Browse files
committed
AUT-4248: Send activeMfaMethodId in send-mfa-controller
1 parent 87149f8 commit 022db74

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/components/common/mfa/send-mfa-controller.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function sendMfaGeneric(
6969
mfaCodeService: MfaServiceInterface
7070
): ExpressRouteFunc {
7171
return async function (req: Request, res: Response) {
72-
const { email } = req.session.user;
72+
const { email, activeMfaMethodId } = req.session.user;
7373
const { sessionId, clientSessionId, persistentSessionId } = res.locals;
7474
const isResendCodeRequest: boolean = req.body.isResendCodeRequest;
7575

@@ -81,6 +81,7 @@ export function sendMfaGeneric(
8181
isResendCodeRequest,
8282
xss(req.cookies.lng as string),
8383
req,
84+
activeMfaMethodId,
8485
getJourneyTypeFromUserSession(req.session.user, {
8586
includeReauthentication: true,
8687
})

src/components/common/mfa/tests/send-mfa-controller.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as journey from "../../journey/journey.js";
1212
import { createMockRequest } from "../../../../../test/helpers/mock-request-helper.js";
1313
import esmock from "esmock";
1414
import type { SinonSpy } from "sinon";
15-
import type { ExpressRouteFunc } from "../../../../types";
15+
import type { ExpressRouteFunc } from "../../../../types.js";
1616

1717
describe("send mfa controller", () => {
1818
let req: RequestOutput;
@@ -47,7 +47,7 @@ describe("send mfa controller", () => {
4747
});
4848

4949
describe("sendMfaGeneric", () => {
50-
it("can send the journeyType when requesting the code", async () => {
50+
it("can send the journeyType and activeMfaMethodId when requesting the code", async () => {
5151
const fakeService: MfaServiceInterface = {
5252
sendMfaCode: sinon.fake.returns({
5353
success: true,
@@ -58,6 +58,7 @@ describe("send mfa controller", () => {
5858
req.session.user = {
5959
email: "test@test.com",
6060
reauthenticate: "test_data",
61+
activeMfaMethodId: "active_mfa_method_id",
6162
};
6263
req.path = PATH_NAMES.RESEND_MFA_CODE;
6364

@@ -79,6 +80,7 @@ describe("send mfa controller", () => {
7980
sinon.match.any,
8081
sinon.match.any,
8182
sinon.match.any,
83+
"active_mfa_method_id",
8284
JOURNEY_TYPE.REAUTHENTICATION
8385
);
8486
});
@@ -122,6 +124,7 @@ describe("send mfa controller", () => {
122124
sinon.match.any,
123125
sinon.match.any,
124126
sinon.match.any,
127+
sinon.match.any,
125128
undefined
126129
);
127130
});
@@ -165,6 +168,7 @@ describe("send mfa controller", () => {
165168
sinon.match.any,
166169
sinon.match.any,
167170
sinon.match.any,
171+
sinon.match.any,
168172
JOURNEY_TYPE.REAUTHENTICATION
169173
);
170174
});

0 commit comments

Comments
 (0)