Skip to content

Commit

Permalink
fix(www): redirect to square start if the user is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil committed Dec 5, 2024
1 parent c61085c commit adb0a9c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/controllers/user/signin-signup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
InvalidCredentialsError,
InvalidEmailError,
LeakedPasswordError,
NotFoundError,
WeakPasswordError,
} from "../../config/errors";
import { createAuthenticatedSession } from "../../managers/session/authenticated";
Expand Down Expand Up @@ -199,6 +200,9 @@ export const postSignInMiddleware = async (

next();
} catch (error) {
if (error instanceof NotFoundError) {
return res.redirect(`/users/start-sign-in?notification=login_required`);
}
if (error instanceof InvalidCredentialsError || error instanceof ZodError) {
return res.redirect(`/users/sign-in?notification=invalid_credentials`);
}
Expand Down

0 comments on commit adb0a9c

Please sign in to comment.