mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-04 10:05:53 +02:00
make all emails lowercase closes #89
This commit is contained in:
parent
d1278c252b
commit
5f92b0bbc1
10 changed files with 73 additions and 15 deletions
|
@ -20,7 +20,10 @@ import { verifySession } from "@server/auth/sessions/verifySession";
|
|||
|
||||
export const loginBodySchema = z
|
||||
.object({
|
||||
email: z.string().email(),
|
||||
email: z
|
||||
.string()
|
||||
.email()
|
||||
.transform((v) => v.toLowerCase()),
|
||||
password: z.string(),
|
||||
code: z.string().optional()
|
||||
})
|
||||
|
|
|
@ -20,7 +20,10 @@ import { hashPassword } from "@server/auth/password";
|
|||
|
||||
export const requestPasswordResetBody = z
|
||||
.object({
|
||||
email: z.string().email()
|
||||
email: z
|
||||
.string()
|
||||
.email()
|
||||
.transform((v) => v.toLowerCase())
|
||||
})
|
||||
.strict();
|
||||
|
||||
|
@ -63,10 +66,7 @@ export async function requestPasswordReset(
|
|||
);
|
||||
}
|
||||
|
||||
const token = generateRandomString(
|
||||
8,
|
||||
alphabet("0-9", "A-Z", "a-z")
|
||||
);
|
||||
const token = generateRandomString(8, alphabet("0-9", "A-Z", "a-z"));
|
||||
await db.transaction(async (trx) => {
|
||||
await trx
|
||||
.delete(passwordResetTokens)
|
||||
|
|
|
@ -19,7 +19,10 @@ import { passwordSchema } from "@server/auth/passwordSchema";
|
|||
|
||||
export const resetPasswordBody = z
|
||||
.object({
|
||||
email: z.string().email(),
|
||||
email: z
|
||||
.string()
|
||||
.email()
|
||||
.transform((v) => v.toLowerCase()),
|
||||
token: z.string(), // reset secret code
|
||||
newPassword: passwordSchema,
|
||||
code: z.string().optional() // 2fa code
|
||||
|
|
|
@ -23,7 +23,7 @@ import { checkValidInvite } from "@server/auth/checkValidInvite";
|
|||
import { passwordSchema } from "@server/auth/passwordSchema";
|
||||
|
||||
export const signupBodySchema = z.object({
|
||||
email: z.string().email(),
|
||||
email: z.string().email().transform((v) => v.toLowerCase()),
|
||||
password: passwordSchema,
|
||||
inviteToken: z.string().optional(),
|
||||
inviteId: z.string().optional()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue