Skip to content

Commit

Permalink
AUT-2789: Log user out when they enter their password incorrectly max…
Browse files Browse the repository at this point in the history
… allowed times.

WIP.
  • Loading branch information
andrew-moores committed Jul 9, 2024
1 parent ac66cb4 commit 76ffd5d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/enter-mfa/tests/enter-mfa-integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ describe("Integration:: enter mfa", () => {
app = await require("../../../app").createApp();
baseApi = process.env.FRONTEND_API_BASE_URL || "";

request(app)
await request(app)
.get(PATH_NAMES.ENTER_MFA)
.end((err, res) => {
.then((res) => {
const $ = cheerio.load(res.text);
token = $("[name=_csrf]").val();
cookies = res.headers["set-cookie"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe("Integration::enter password", () => {

app = await require("../../../app").createApp();
baseApi = process.env.FRONTEND_API_BASE_URL;
process.env.SUPPORT_2HR_LOCKOUT = "1";

await request(app)
.get(ENDPOINT)
Expand All @@ -57,6 +58,8 @@ describe("Integration::enter password", () => {
after(() => {
sinon.restore();
app = undefined;
process.env.SUPPORT_2HR_LOCKOUT = "1";

});

it("should return enter password page", (done) => {
Expand Down Expand Up @@ -91,6 +94,7 @@ describe("Integration::enter password", () => {

it("should return validation error when password is incorrect", (done) => {
nock(baseApi).post(API_ENDPOINTS.LOG_IN_USER).once().reply(401);
process.env.SUPPORT_2HR_LOCKOUT = "0";

request(app)
.post(ENDPOINT)
Expand Down Expand Up @@ -137,7 +141,7 @@ describe("Integration::enter password", () => {
_csrf: token,
password: "password",
})
.expect("Location", PATH_NAMES.ACCOUNT_LOCKED)
.expect("Location", PATH_NAMES.SIGNED_OUT.concat("?error=login_required"))
.expect(302, done);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ describe("Integration::enter password", () => {
app = await require("../../../app").createApp();
baseApi = process.env.FRONTEND_API_BASE_URL;

request(app)
await request(app)
.get(ENDPOINT)
.end((err, res) => {
.then((res) => {
const $ = cheerio.load(res.text);
token = $("[name=_csrf]").val();
cookies = res.headers["set-cookie"];
Expand Down Expand Up @@ -128,6 +128,7 @@ describe("Integration::enter password", () => {

it("should return validation error when password is incorrect", (done) => {
nock(baseApi).post(API_ENDPOINTS.LOG_IN_USER).once().reply(401);
process.env.SUPPORT_2HR_LOCKOUT = "0"

request(app)
.post(ENDPOINT)
Expand Down Expand Up @@ -201,7 +202,7 @@ describe("Integration::enter password", () => {
_csrf: token,
password: "password",
})
.expect("Location", PATH_NAMES.ACCOUNT_LOCKED)
.expect("Location", PATH_NAMES.SIGNED_OUT.concat("?error=login_required"))
.expect(302, done);
});
});

0 comments on commit 76ffd5d

Please sign in to comment.