✨ feat(auth): Enhance user registration with invite handling and logo display
This commit is contained in:
parent
938363b1eb
commit
207bc247f4
@ -21,7 +21,9 @@ export default function Page() {
|
|||||||
<div className='flex bg-cover bg-center lg:w-1/2 lg:flex-auto'>
|
<div className='flex bg-cover bg-center lg:w-1/2 lg:flex-auto'>
|
||||||
<div className='lg:py-15 md:px-15 flex w-full flex-col items-center justify-center px-5 py-7'>
|
<div className='lg:py-15 md:px-15 flex w-full flex-col items-center justify-center px-5 py-7'>
|
||||||
<Link className='mb-0 flex flex-col items-center lg:mb-12' href='/'>
|
<Link className='mb-0 flex flex-col items-center lg:mb-12' href='/'>
|
||||||
<Image src={site.site_logo} height={48} width={48} alt='logo' unoptimized />
|
{site.site_logo && (
|
||||||
|
<Image src={site.site_logo} height={48} width={48} alt='logo' unoptimized />
|
||||||
|
)}
|
||||||
<span className='text-2xl font-semibold'>{site.site_name}</span>
|
<span className='text-2xl font-semibold'>{site.site_name}</span>
|
||||||
</Link>
|
</Link>
|
||||||
<DotLottieReact
|
<DotLottieReact
|
||||||
|
|||||||
@ -66,11 +66,12 @@ export default function UserRegisterForm({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
...initialValues,
|
...initialValues,
|
||||||
invite: sessionStorage.getItem('invite'),
|
invite: localStorage.getItem('invite') || '',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -159,7 +160,7 @@ export default function UserRegisterForm({
|
|||||||
<FormItem>
|
<FormItem>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<Input
|
||||||
disabled={loading}
|
disabled={loading || !!localStorage.getItem('invite')}
|
||||||
placeholder={t('invite')}
|
placeholder={t('invite')}
|
||||||
{...field}
|
{...field}
|
||||||
value={field.value || ''}
|
value={field.value || ''}
|
||||||
|
|||||||
@ -42,6 +42,14 @@ export default function Providers({
|
|||||||
setCommon(common);
|
setCommon(common);
|
||||||
}, [setCommon, common]);
|
}, [setCommon, common]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const searchParams = new URLSearchParams(location.search);
|
||||||
|
const invite = searchParams.get('invite');
|
||||||
|
if (invite) {
|
||||||
|
localStorage.setItem('invite', invite);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NextThemesProvider attribute='class' defaultTheme='system' enableSystem>
|
<NextThemesProvider attribute='class' defaultTheme='system' enableSystem>
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user