Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Lines marked **Upgrade step** need you to act after updating.

### Fixed

- Clicking "Log in" on the two-factor code screen now sends the code. Before, only Enter worked. (#299)
- No more PHP 8.5 deprecation warning for the MySQL SSL option on container start. (#298)

## [2.3.0] - 2026-10-22
Expand Down
45 changes: 45 additions & 0 deletions resources/js/Pages/Auth/TwoFactorChallenge.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { mount } from "@vue/test-utils";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { router, useForm } from "@inertiajs/vue3";
import TwoFactorChallenge from "./TwoFactorChallenge.vue";

const mountChallenge = () =>
mount(TwoFactorChallenge, {
attachTo: document.body,
global: {
mocks: { $inertia: { form: useForm }, route: (name: string) => name },
stubs: { Head: true, Link: true, JetValidationErrors: true },
},
});

describe("log in button on the two-factor challenge", () => {
beforeEach(() => {
vi.restoreAllMocks();
vi.spyOn(router, "post").mockImplementation(() => {});
});

it("sends the code when clicked", async () => {
const wrapper = mountChallenge();

await wrapper.find("input").setValue("123456");
await wrapper.find("button[type=submit]").trigger("click");

expect(router.post).toHaveBeenCalledOnce();
expect(vi.mocked(router.post).mock.calls[0][1]).toMatchObject({
code: "123456",
});
});

it("sends the recovery code when clicked", async () => {
const wrapper = mountChallenge();

await wrapper.find("button[type=button]").trigger("click");
await wrapper.find("input").setValue("abc-def");
await wrapper.find("button[type=submit]").trigger("click");

expect(router.post).toHaveBeenCalledOnce();
expect(vi.mocked(router.post).mock.calls[0][1]).toMatchObject({
recovery_code: "abc-def",
});
});
});
1 change: 1 addition & 0 deletions resources/js/Pages/Auth/TwoFactorChallenge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
</button>

<d9-button
type="submit"
class="ml-4"
:isLoading="form.processing"
:disabled="form.processing"
Expand Down
Loading