Skip to content

Commit

Permalink
Made the response msgs more ambiguous
Browse files Browse the repository at this point in the history
  • Loading branch information
ab-elhaddad committed Oct 30, 2023
1 parent 0fd48bb commit 37f5a62
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/models/users.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class Users {
where: { u_email: email },
select: { u_password: true, u_is_confirmed: true, u_id: true }
});
if (user === null) throw { message: `The email doesn't exist`, statusCode: 404 }; // Not Found
if (!user.u_is_confirmed) throw { message: `The account is not confirmed`, statusCode: 403 }; // Forbidden
if (user === null) throw { message: `Wrong Email or Password!`, statusCode: 403 };
if (!user.u_is_confirmed) throw { message: `Wrong Email or Password!`, statusCode: 403 }; // Forbidden

if (!bcrypt.compareSync(password, user?.u_password as string)) throw { message: `The password is wrong`, statusCode: 403 }; // Forbidden
if (!bcrypt.compareSync(password, user?.u_password as string)) throw { message: `Wrong Email or Password!`, statusCode: 403 }; // Forbidden

return user.u_id;
}
Expand Down

0 comments on commit 37f5a62

Please sign in to comment.