Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Make identifier in verification tokens case insensitive #919

Merged
merged 1 commit into from
Oct 27, 2023
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
28 changes: 22 additions & 6 deletions apps/web/tests/authentication.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ test.describe.serial(() => {
).toBeVisible();
});

test.describe("login", () => {
test.afterEach(async ({ page }) => {
await page.goto("/logout");
});
});

test("can login with magic link", async ({ page }) => {
await page.goto("/login");

Expand Down Expand Up @@ -155,5 +149,27 @@ test.describe.serial(() => {

await expect(page.getByText("Test User")).toBeVisible();
});

test("allow using different case in email", async ({ page }) => {
await page.goto("/login");

await page
.getByPlaceholder("[email protected]")
.type("[email protected]");

await page.getByRole("button", { name: "Continue" }).click();

const code = await getCode();

await page.getByPlaceholder("Enter your 6-digit code").type(code);

await page.getByRole("button", { name: "Continue" }).click();

await page.waitForURL("/polls");

await page.getByTestId("user-dropdown").click();

await expect(page.getByText("Test User")).toBeVisible();
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "verification_tokens" ALTER COLUMN "identifier" SET DATA TYPE CITEXT;
2 changes: 1 addition & 1 deletion packages/database/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ model Comment {
}

model VerificationToken {
identifier String
identifier String @db.Citext
token String @unique
expires DateTime

Expand Down