feat(auth): Enhance user registration with invite handling and logo display

This commit is contained in:
web@ppanel 2025-01-14 16:33:09 +07:00
parent 938363b1eb
commit 207bc247f4
4 changed files with 14 additions and 3 deletions

View File

@ -21,7 +21,9 @@ export default function Page() {
<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'>
<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>
</Link>
<DotLottieReact

View File

@ -66,11 +66,12 @@ export default function UserRegisterForm({
});
}
});
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
...initialValues,
invite: sessionStorage.getItem('invite'),
invite: localStorage.getItem('invite') || '',
},
});
@ -159,7 +160,7 @@ export default function UserRegisterForm({
<FormItem>
<FormControl>
<Input
disabled={loading}
disabled={loading || !!localStorage.getItem('invite')}
placeholder={t('invite')}
{...field}
value={field.value || ''}

View File

@ -42,6 +42,14 @@ export default function Providers({
setCommon(common);
}, [setCommon, common]);
useEffect(() => {
const searchParams = new URLSearchParams(location.search);
const invite = searchParams.get('invite');
if (invite) {
localStorage.setItem('invite', invite);
}
}, []);
return (
<NextThemesProvider attribute='class' defaultTheme='system' enableSystem>
<QueryClientProvider client={queryClient}>

BIN
bun.lockb

Binary file not shown.