feat: add registration link on sign-in page
Login page now shows "Don't have an account? Create a new account" link to /sign-up when registration is enabled, replacing the old "Contact tenant operator" mailto link. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+27
-8
@@ -1,12 +1,21 @@
|
||||
import { useSearch } from '@tanstack/react-router'
|
||||
import { Link, useSearch } from '@tanstack/react-router'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { ArrowUpRight } from 'lucide-react'
|
||||
import { useStatus } from '@/hooks/use-status'
|
||||
import { AuthLayout } from '../auth-layout'
|
||||
import { UserAuthForm } from './components/user-auth-form'
|
||||
|
||||
export function SignIn() {
|
||||
const { t } = useTranslation()
|
||||
const { redirect } = useSearch({ from: '/(auth)/sign-in' })
|
||||
const { status } = useStatus()
|
||||
|
||||
const registerEnabled =
|
||||
status?.register_enabled ??
|
||||
status?.data?.register_enabled ??
|
||||
status?.password_register_enabled ??
|
||||
status?.data?.password_register_enabled ??
|
||||
true
|
||||
|
||||
return (
|
||||
<AuthLayout>
|
||||
@@ -47,6 +56,21 @@ export function SignIn() {
|
||||
<UserAuthForm redirectTo={redirect} />
|
||||
|
||||
<div className='space-y-3 border-t border-dashed border-[color-mix(in_oklch,var(--primary)_22%,var(--border))] pt-5'>
|
||||
{registerEnabled ? (
|
||||
<>
|
||||
<p className='text-xs font-semibold tracking-[0.16em] text-muted-foreground uppercase'>
|
||||
{t("Don't have an account?")}
|
||||
</p>
|
||||
<Link
|
||||
to='/sign-up'
|
||||
className='inline-flex items-center gap-1 text-sm font-medium text-primary hover:underline'
|
||||
>
|
||||
{t('Create a new account')}
|
||||
<ArrowUpRight className='h-3.5 w-3.5' />
|
||||
</Link>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p className='text-xs font-semibold tracking-[0.16em] text-muted-foreground uppercase'>
|
||||
{t('Need access?')}
|
||||
</p>
|
||||
@@ -55,13 +79,8 @@ export function SignIn() {
|
||||
'Account provisioning is handled by your platform administrator. Reach out to the Heicode operator to be added to a tenant.'
|
||||
)}
|
||||
</p>
|
||||
<a
|
||||
href='mailto:operators@heicode.local'
|
||||
className='inline-flex items-center gap-1 text-sm font-medium text-primary hover:underline'
|
||||
>
|
||||
{t('Contact tenant operator')}
|
||||
<ArrowUpRight className='h-3.5 w-3.5' />
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</AuthLayout>
|
||||
|
||||
Reference in New Issue
Block a user