Skip to content

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

Make the support link and cancel visible while loading.

Ivan Vasilov2bfae22e9818
diff --git a/studio/components/interfaces/SignIn/SignInMfaForm.tsx b/studio/components/interfaces/SignIn/SignInMfaForm.tsx
index 2b669e5546d..126dc9d7767 100644
--- a/studio/components/interfaces/SignIn/SignInMfaForm.tsx
+++ b/studio/components/interfaces/SignIn/SignInMfaForm.tsx
@@ -22,7 +22,11 @@ const SignInMfaForm = () => {
const pushNext = usePushNext()
const queryClient = useQueryClient()
const router = useRouter()
- const { data: factors, isSuccess: factorsSuccess } = useMfaListFactorsQuery()
+ const {
+ data: factors,
+ isSuccess: factorsSuccess,
+ isLoading: areFactorsLoading,
+ } = useMfaListFactorsQuery()
const { mutateAsync: mfaChallengeAndVerify, isLoading } = useMfaChallengeAndVerifyMutation()
const [selectedFactor, setSelectedFactor] = useState<Factor | null>(null)
const signOut = useSignOut()
@@ -76,69 +80,69 @@ const SignInMfaForm = () => {
}
}
- if (!selectedFactor) {
- return <Loading />
- }
-
return (
<>
- <Form
- validateOnBlur
- id="sign-in-mfa-form"
- initialValues={{ code: '' }}
- validationSchema={signInSchema}
- onSubmit={onSignIn}
- >
- {() => (
- <div className="flex flex-col gap-4">
- <Input
- id="code"
- name="code"
- type="text"
- autoFocus
- icon={<IconLock />}
- placeholder="XXXXXX"
- disabled={isLoading}
- autoComplete="off"
- spellCheck="false"
- autoCapitalize="none"
- autoCorrect="off"
- label={
- selectedFactor && factors?.totp.length === 2
- ? `Code generated by ${selectedFactor.friendly_name}`
- : null
- }
- />
+ {areFactorsLoading ? (
+ <Loading />
+ ) : (
+ <Form
+ validateOnBlur
+ id="sign-in-mfa-form"
+ initialValues={{ code: '' }}
+ validationSchema={signInSchema}
+ onSubmit={onSignIn}
+ >
+ {() => (
+ <div className="flex flex-col gap-4">
+ <Input
+ id="code"
+ name="code"
+ type="text"
+ autoFocus
+ icon={<IconLock />}
+ placeholder="XXXXXX"
+ disabled={isLoading}
+ autoComplete="off"
+ spellCheck="false"
+ autoCapitalize="none"
+ autoCorrect="off"
+ label={
+ selectedFactor && factors?.totp.length === 2
+ ? `Code generated by ${selectedFactor.friendly_name}`
+ : null
+ }
+ />
- <Button
- block
- form="sign-in-mfa-form"
- htmlType="submit"
- size="large"
- disabled={isLoading}
- loading={isLoading}
- >
- {isLoading ? 'Verifying' : 'Verify'}
- </Button>
- {factors?.totp.length === 2 && (
- <div className="text-sm flex flex-col items-center w-full gap-1">
- <div>
- <span className="text-scale-900">Having problems?</span>{' '}
- <a
- className="text-white hover:border-b border-white"
- href="#"
- onClick={() =>
- setSelectedFactor(factors.totp.find((f) => f.id !== selectedFactor?.id)!)
- }
- >{`Authenticate using ${
- factors.totp.find((f) => f.id !== selectedFactor?.id)?.friendly_name
- }?`}</a>
+ <Button
+ block
+ form="sign-in-mfa-form"
+ htmlType="submit"
+ size="large"
+ disabled={isLoading}
+ loading={isLoading}
+ >
+ {isLoading ? 'Verifying' : 'Verify'}
+ </Button>
+ {factors?.totp.length === 2 && (
+ <div className="text-sm flex flex-col items-center w-full gap-1">
+ <div>
+ <span className="text-scale-900">Having problems?</span>{' '}
+ <a
+ className="text-white hover:border-b border-white"
+ href="#"
+ onClick={() =>
+ setSelectedFactor(factors.totp.find((f) => f.id !== selectedFactor?.id)!)
+ }
+ >{`Authenticate using ${
+ factors.totp.find((f) => f.id !== selectedFactor?.id)?.friendly_name
+ }?`}</a>
+ </div>
</div>
- </div>
- )}
- </div>
- )}
- </Form>
+ )}
+ </div>
+ )}
+ </Form>
+ )}
<div>
<a
className="underline transition text-scale-1100 hover:text-scale-1200 cursor-pointer"