Skip to content

Commit b10c64b

Browse files
authored
🐛 Make identifier in verification tokens case insensitive (#919)
1 parent 768b73c commit b10c64b

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

apps/web/tests/authentication.spec.ts

+22-6
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,6 @@ test.describe.serial(() => {
9696
).toBeVisible();
9797
});
9898

99-
test.describe("login", () => {
100-
test.afterEach(async ({ page }) => {
101-
await page.goto("/logout");
102-
});
103-
});
104-
10599
test("can login with magic link", async ({ page }) => {
106100
await page.goto("/login");
107101

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

156150
await expect(page.getByText("Test User")).toBeVisible();
157151
});
152+
153+
test("allow using different case in email", async ({ page }) => {
154+
await page.goto("/login");
155+
156+
await page
157+
.getByPlaceholder("[email protected]")
158+
159+
160+
await page.getByRole("button", { name: "Continue" }).click();
161+
162+
const code = await getCode();
163+
164+
await page.getByPlaceholder("Enter your 6-digit code").type(code);
165+
166+
await page.getByRole("button", { name: "Continue" }).click();
167+
168+
await page.waitForURL("/polls");
169+
170+
await page.getByTestId("user-dropdown").click();
171+
172+
await expect(page.getByText("Test User")).toBeVisible();
173+
});
158174
});
159175
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "verification_tokens" ALTER COLUMN "identifier" SET DATA TYPE CITEXT;

packages/database/prisma/schema.prisma

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ model Comment {
228228
}
229229

230230
model VerificationToken {
231-
identifier String
231+
identifier String @db.Citext
232232
token String @unique
233233
expires DateTime
234234

0 commit comments

Comments
 (0)