--- import Layout from '../layouts/Layout.astro'; import { Icon } from 'astro-icon/components'; import { db } from '../db'; import { siteSettings, users } from '../db/schema'; import { eq, count } from 'drizzle-orm'; if (Astro.locals.user) { return Astro.redirect('/dashboard'); } const userCountResult = await db.select({ count: count() }).from(users).get(); const isFirstUser = userCountResult ? userCountResult.count === 0 : true; let registrationDisabled = false; if (!isFirstUser) { const registrationSetting = await db.select() .from(siteSettings) .where(eq(siteSettings.key, 'registration_enabled')) .get(); registrationDisabled = registrationSetting?.value !== 'true'; } const error = Astro.url.searchParams.get('error'); const errorMessage = error === 'user_exists' ? 'An account with this email already exists' : error === 'missing_fields' ? 'Please fill in all fields' : error === 'registration_disabled' ? 'Registration is currently disabled' : null; ---
Chronus

Create Account

Join Chronus to start tracking time

{errorMessage && ( )} {registrationDisabled ? ( <>
Registration is currently disabled by the site administrator.

Already have an account? Sign in

) : ( <>
Full Name
Email
Password
OR

Already have an account? Sign in

)}