import React from 'react'; import GuestLayout from '@/Layouts/GuestLayout'; import { Head, Link, useForm, usePage } from '@inertiajs/react'; export default function Register() { const { system_settings } = usePage().props as any; const isRegistrationEnabled = system_settings?.allow_registration === '1' || system_settings?.allow_registration === true; const isGoogleEnabled = system_settings?.oauth_google_enabled === '1' || system_settings?.oauth_google_enabled === true; const isGithubEnabled = system_settings?.oauth_github_enabled === '1' || system_settings?.oauth_github_enabled === true; const { data, setData, post, processing, errors, reset } = useForm({ first_name: '', last_name: '', email: '', password: '', password_confirmation: '', }); const submit = (e: React.FormEvent) => { e.preventDefault(); post(route('register'), { onFinish: () => reset('password', 'password_confirmation') }); }; if (!isRegistrationEnabled) { return (

Registration closed

New account registration is currently disabled by the administrator.

← Back to sign in
); } return ( {/* Heading */}

Create account

Fill in your details to get started.

{/* OAuth */} {(isGoogleEnabled || isGithubEnabled) && (
{isGoogleEnabled && ( Google )} {isGithubEnabled && ( GitHub )}
or
)} {/* Form */}
setData('first_name', e.target.value)} placeholder="Alex" className={`auth-input${errors.first_name ? ' !border-red-300 !bg-red-50/50' : ''}`} /> {errors.first_name &&

{errors.first_name}

}
setData('last_name', e.target.value)} placeholder="Johnson" className={`auth-input${errors.last_name ? ' !border-red-300 !bg-red-50/50' : ''}`} /> {errors.last_name &&

{errors.last_name}

}
setData('email', e.target.value)} placeholder="you@company.com" className={`auth-input${errors.email ? ' !border-red-300 !bg-red-50/50' : ''}`} /> {errors.email &&

{errors.email}

}
setData('password', e.target.value)} placeholder="Min. 8 characters" className={`auth-input${errors.password ? ' !border-red-300 !bg-red-50/50' : ''}`} /> {errors.password &&

{errors.password}

}
setData('password_confirmation', e.target.value)} placeholder="••••••••" className={`auth-input${errors.password_confirmation ? ' !border-red-300 !bg-red-50/50' : ''}`} /> {errors.password_confirmation &&

{errors.password_confirmation}

}

Already have an account?{' '} Sign in

); }