Skip to content

Commit

Permalink
fix backend to return an error
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyblasczyk committed Oct 13, 2024
1 parent 24749ac commit 455d245
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/auth/src/utils/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const getUserByEmail = (email: string) =>

export const getUserByCredentials = async (email: string, password: string) => {
const user = await getUserByEmail(email);
if (user == null) return null;
if (user == null) return new Error("Invalid credentials");
const { passwordHash } = user;
if (passwordHash == null) return null;
if (passwordHash == null) return new Error("Invalid credentials");
const isPasswordCorrect = compareSync(password, passwordHash);
return isPasswordCorrect ? user : null;
return isPasswordCorrect ? user : new Error("Invalid credentials");
};

0 comments on commit 455d245

Please sign in to comment.