Initial commit v1.1

This commit is contained in:
Rolf
2026-03-18 13:34:41 +01:00
parent cb04bf2ab8
commit b982584244
38 changed files with 3196 additions and 1103 deletions
+6 -13
View File
@@ -1,7 +1,7 @@
'use client'
import { useState } from 'react'
import { createClient } from '@/lib/supabase/client'
import { authClient } from '@/lib/auth-client'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
@@ -17,17 +17,13 @@ export default function LoginPage() {
setLoading(true)
setError(null)
const supabase = createClient()
const { error } = await supabase.auth.signInWithOtp({
const { error } = await authClient.signIn.magicLink({
email,
options: {
emailRedirectTo: `${window.location.origin}/auth/confirm`,
shouldCreateUser: false, // invite-only: only existing users can log in
},
callbackURL: '/dashboard',
})
if (error) {
setError(error.message)
setError(error.message ?? 'Could not send link. Have you been invited?')
} else {
setSubmitted(true)
}
@@ -41,8 +37,7 @@ export default function LoginPage() {
<div className="text-4xl"></div>
<h1 className="text-2xl font-bold">Check your email</h1>
<p className="text-muted-foreground">
We sent a magic link to <strong>{email}</strong>. Tap the link to
sign in.
We sent a magic link to <strong>{email}</strong>. Tap it to sign in.
</p>
</div>
</div>
@@ -72,9 +67,7 @@ export default function LoginPage() {
autoFocus
/>
</div>
{error && <p className="text-destructive text-sm">{error}</p>}
{error && <p className="text-sm text-destructive">{error}</p>}
<Button type="submit" className="w-full" disabled={loading}>
{loading ? 'Sending…' : 'Send magic link'}
</Button>