Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🐛 Make identifier in verification tokens case insensitive (#919)

Luke Vellab10c64b7daf3
diff --git a/apps/web/tests/authentication.spec.ts b/apps/web/tests/authentication.spec.ts
index a736fc09d..d1d80590b 100644
--- a/apps/web/tests/authentication.spec.ts
+++ b/apps/web/tests/authentication.spec.ts
@@ -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");
@@ -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();
+ });
});
});
diff --git a/packages/database/prisma/migrations/20231027074632_nextauth_ci_identifiers/migration.sql b/packages/database/prisma/migrations/20231027074632_nextauth_ci_identifiers/migration.sql
new file mode 100644
index 000000000..e5ee2a167
--- /dev/null
+++ b/packages/database/prisma/migrations/20231027074632_nextauth_ci_identifiers/migration.sql
@@ -0,0 +1,2 @@
+-- AlterTable
+ALTER TABLE "verification_tokens" ALTER COLUMN "identifier" SET DATA TYPE CITEXT;
diff --git a/packages/database/prisma/schema.prisma b/packages/database/prisma/schema.prisma
index e263663dd..37460fab2 100644
--- a/packages/database/prisma/schema.prisma
+++ b/packages/database/prisma/schema.prisma
@@ -228,7 +228,7 @@ model Comment {
}
model VerificationToken {
- identifier String
+ identifier String @db.Citext
token String @unique
expires DateTime