Skip to content

Commit

Permalink
Merge pull request #182 from Subas-mohanty/feat/temp-email-block
Browse files Browse the repository at this point in the history
feat : temp email auth block
  • Loading branch information
SkidGod4444 authored Jan 10, 2025
2 parents b7fc64a + fe76574 commit 75181f9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/auth/src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { betterAuth, BetterAuthOptions } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { prisma } from "@plura/db";
import { multiSession } from "better-auth/plugins";
import { emailHarmony } from 'better-auth-harmony';

const BaseDomain = process.env.NODE_ENV === "production" ? "https://api.plura.pro": "http://localhost:3001";

Expand All @@ -19,7 +20,9 @@ export const auth = betterAuth({
provider: "postgresql",
}),
secret: process.env.BETTER_AUTH_SECRET,
plugins: [multiSession()],
plugins: [multiSession(), emailHarmony({
allowNormalizedSignin: false,
})],
user: {
additionalFields:{
isOnboarding: {
Expand All @@ -35,6 +38,10 @@ export const auth = betterAuth({
required : true,
input : false,
defaultValue : "user"
},
normalizedEmail : {
type : "string",
unique : true
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
Warnings:
- A unique constraint covering the columns `[normalizedEmail]` on the table `user` will be added. If there are existing duplicate values, this will fail.
- Added the required column `normalizedEmail` to the `user` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "user" ADD COLUMN "normalizedEmail" TEXT NOT NULL;

-- CreateIndex
CREATE UNIQUE INDEX "user_normalizedEmail_key" ON "user"("normalizedEmail");
1 change: 1 addition & 0 deletions packages/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ model User {
workspaces Workspace[]
projects Project[]
role String @default("user")
normalizedEmail String @unique
@@unique([email])
@@map("user")
Expand Down

0 comments on commit 75181f9

Please sign in to comment.