fix: oidc login failed message before redirect (#5648)

This commit is contained in:
Laurin Quast 2024-10-08 13:01:31 +02:00 committed by GitHub
parent 9c626df401
commit 19d002173f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 5 deletions

View file

@ -14,8 +14,9 @@ function AuthOIDC(props: { oidcId: string; redirectToPath: string }) {
if (!env.auth.oidc) {
throw new Error('OIDC provider is not configured');
}
await startAuthFlowForOIDCProvider(props.oidcId);
// we need to return something, otherwise react-query will throw an error
return true;
},
});

View file

@ -1,4 +1,4 @@
import { useCallback } from 'react';
import { useCallback, useEffect } from 'react';
import { CircleHelpIcon } from 'lucide-react';
import { useForm } from 'react-hook-form';
import { useSessionContext } from 'supertokens-auth-react/recipe/session';
@ -102,11 +102,14 @@ export function AuthSSOPage(props: { redirectToPath: string }) {
},
disabled: sso.isPending,
});
useEffect(() => {
form.setFocus('slug', { shouldSelect: true });
}, [sso.isPending]);
const { toast } = useToast();
const onSubmit = useCallback(
(data: SSOFormValues) => {
sso.reset();
sso.mutate({
slug: data.slug,
});
@ -143,7 +146,7 @@ export function AuthSSOPage(props: { redirectToPath: string }) {
<FormField
control={form.control}
name="slug"
render={({ field }) => (
render={() => (
<FormItem>
<FormLabel className="flex flex-row items-center gap-x-2">
Organization slug{' '}
@ -163,7 +166,7 @@ export function AuthSSOPage(props: { redirectToPath: string }) {
</TooltipProvider>
</FormLabel>
<FormControl>
<Input placeholder="acme" {...field} />
<Input placeholder="acme" {...form.register('slug')} />
</FormControl>
<FormMessage />
</FormItem>