make V1 Mail Case-Insensitive

This commit is contained in:
Nicolas
2025-07-23 10:10:18 +02:00
parent d003b2cf12
commit 34a232024e
3 changed files with 3 additions and 3 deletions

View File

@@ -13,7 +13,7 @@ export const resetPassword = async (email: string) => {
email,
},
});
const oldUser = (OLD_USER as OldUser[]).find((u) => u.email === email);
const oldUser = (OLD_USER as OldUser[]).find((u) => u.email.toLowerCase() === email.toLowerCase());
if (!user) {
if (oldUser) {
user = await createNewUserFromOld(oldUser);

View File

@@ -29,7 +29,7 @@ export const register = async ({ password, ...user }: Omit<Prisma.UserCreateInpu
},
});
const existingOldUser = (OLD_USER as OldUser[]).find((u) => u.email === user.email);
const existingOldUser = (OLD_USER as OldUser[]).find((u) => u.email.toLocaleLowerCase() === user.email.toLocaleLowerCase());
if (existingUser) {
return {

View File

@@ -20,7 +20,7 @@ export const options: AuthOptions = {
const user = await prisma.user.findFirst({
where: { email: credentials.email },
});
const v1User = (oldUser as OldUser[]).find((u) => u.email === credentials.email);
const v1User = (oldUser as OldUser[]).find((u) => u.email.toLowerCase() === credentials.email.toLowerCase());
if (!user && v1User) {
if (bcrypt.compareSync(credentials.password, v1User.password)) {
const newUser = await createNewUserFromOld(v1User);