Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

[FE-1926] chore: show sign in error (#39392)

Alaister Young3c2d849e1ca8
diff --git a/apps/studio/components/interfaces/SignIn/SignInMfaForm.tsx b/apps/studio/components/interfaces/SignIn/SignInMfaForm.tsx
index c1e09f73f7c..31e22f38b25 100644
--- a/apps/studio/components/interfaces/SignIn/SignInMfaForm.tsx
+++ b/apps/studio/components/interfaces/SignIn/SignInMfaForm.tsx
@@ -8,6 +8,7 @@ import { useEffect, useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
import z from 'zod'
+import { useAuthError } from 'common'
import AlertError from 'components/ui/AlertError'
import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
import { useMfaChallengeAndVerifyMutation } from 'data/profile/mfa-challenge-and-verify-mutation'
@@ -86,6 +87,22 @@ export const SignInMfaForm = ({ context = 'sign-in' }: SignInMfaFormProps) => {
}
}, [factors?.totp, isSuccessFactors, router, queryClient])
+ const error = useAuthError()
+
+ if (error) {
+ return (
+ <AlertError
+ error={error}
+ subject="Error while signing in"
+ additionalActions={
+ <Button asChild type="warning" className="w-min">
+ <Link href="/sign-in">Back to sign in</Link>
+ </Button>
+ }
+ />
+ )
+ }
+
return (
<>
{isLoadingFactors && <GenericSkeletonLoader />}
diff --git a/apps/studio/components/ui/AlertError.tsx b/apps/studio/components/ui/AlertError.tsx
index 117b051c8ef..a49ec335e9d 100644
--- a/apps/studio/components/ui/AlertError.tsx
+++ b/apps/studio/components/ui/AlertError.tsx
@@ -15,6 +15,7 @@ export interface AlertErrorProps {
error?: { message: string } | null
className?: string
showIcon?: boolean
+ additionalActions?: React.ReactNode
}
// [Joshen] To standardize the language for all error UIs
@@ -26,6 +27,7 @@ export const AlertError = ({
className,
showIcon = true,
children,
+ additionalActions,
}: PropsWithChildren<AlertErrorProps>) => {
const subjectString = subject?.replace(/ /g, '%20')
let href = `/support/new?category=dashboard_bug`
@@ -51,9 +53,12 @@ export const AlertError = ({
</p>
</div>
{children}
- <Button asChild type="warning" className="w-min">
- <Link href={href}>Contact support</Link>
- </Button>
+ <div className="flex gap-2">
+ {additionalActions}
+ <Button asChild type="warning" className="w-min">
+ <Link href={href}>Contact support</Link>
+ </Button>
+ </div>
</AlertDescription_Shadcn_>
</Alert_Shadcn_>
)