Skip to content

Commit

Permalink
Merge pull request #1482 from RajuGangitla/main
Browse files Browse the repository at this point in the history
fix: add proper messages
  • Loading branch information
steven-tey authored Oct 14, 2024
2 parents cd68197 + 2dcb5a6 commit 6317868
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion apps/web/app/app.dub.co/(auth)/login/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ const errorCodes = {
"Account has been locked due to too many login attempts. Please contact support to unlock your account.",
"too-many-login-attempts": "Too many login attempts. Please try again later.",
"email-not-verified": "Please verify your email address.",
Callback:
"We encountered an issue processing your request. Please try again or contact support if the problem persists.",
OAuthSignin:
"There was an issue signing you in. Please ensure your provider settings are correct.",
OAuthCallback:
"We faced a problem while processing the response from the OAuth provider. Please try again.",
};

const LoginFormContext = createContext<{
Expand Down Expand Up @@ -89,7 +95,11 @@ export default function LoginForm() {

useEffect(() => {
const error = searchParams?.get("error");
error && toast.error(error);
if (error && errorCodes[error]) {
toast.error(errorCodes[error]);
} else {
toast.error("An unexpected error occurred. Please try again later.");
}
}, [searchParams]);

const { isMobile } = useMediaQuery();
Expand Down

0 comments on commit 6317868

Please sign in to comment.