Merge pull request #605 from Dokploy/feat/add-email-verification

Feat/add email verification
This commit is contained in:
Mauricio Siu
2024-10-26 19:39:59 -06:00
committed by GitHub
26 changed files with 4472 additions and 346 deletions

View File

@@ -50,6 +50,8 @@ export const auth = pgTable("auth", {
.$defaultFn(() => new Date().toISOString()),
resetPasswordToken: text("resetPasswordToken"),
resetPasswordExpiresAt: text("resetPasswordExpiresAt"),
confirmationToken: text("confirmationToken"),
confirmationExpiresAt: text("confirmationExpiresAt"),
});
export const authRelations = relations(auth, ({ many }) => ({

View File

@@ -20,7 +20,7 @@ export const createInvitation = async (
const result = await tx
.insert(auth)
.values({
email: input.email,
email: input.email.toLowerCase(),
rol: "user",
password: bcrypt.hashSync("01231203012312", 10),
})

View File

@@ -24,7 +24,7 @@ export const createAdmin = async (input: typeof apiCreateAdmin._type) => {
const newAuth = await tx
.insert(auth)
.values({
email: input.email,
email: input.email.toLowerCase(),
password: hashedPassword,
rol: "admin",
})
@@ -93,7 +93,7 @@ export const findAuthByEmail = async (email: string) => {
if (!result) {
throw new TRPCError({
code: "NOT_FOUND",
message: "Auth not found",
message: "User not found",
});
}
return result;