Skip to content

Commit

Permalink
add check to signin - checking verified status + error
Browse files Browse the repository at this point in the history
  • Loading branch information
jancimertel committed May 21, 2024
1 parent 0f25987 commit 49c7241
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/server/src/modules/users/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,10 @@ export default Router()
throw new UserNotActiveError(UserNotActiveError.message, user.email);
}

if (!user.verified) {
throw new UserNotActiveError(UserNotActiveError.messageVerified, user.email);
}

if (!checkPassword(rawPassword, user.password || "")) {
throw new BadCredentialsError("wrong password");
}
Expand Down
1 change: 1 addition & 0 deletions packages/shared/types/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class UserNotActiveError extends CustomError {
public static code = 403;
public static title = "Inactive user";
public static message = "User $1 is not active";
public static messageVerified = "User $1 is not verified";

constructor(m: string, userId: string) {
super(m);
Expand Down

0 comments on commit 49c7241

Please sign in to comment.