make V1 Mail Case-Insensitive
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user