"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; import { Loader2, ShieldCheck } from "lucide-react"; import { toast } from "sonner"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { MicrosoftButton } from "@/components/auth/microsoft-button"; import { Separator } from "@/components/ui/separator"; import { authClient } from "@/lib/auth-client"; export default function SetupPage() { const router = useRouter(); const [isLoading, setIsLoading] = useState(false); async function handleSendMagicLink() { setIsLoading(true); try { // Get current user's email from session const session = await authClient.getSession(); if (!session?.data?.user?.email) { toast.error("Unable to get user email"); return; } const result = await authClient.signIn.magicLink({ email: session.data.user.email, callbackURL: "/", }); if (result.error) { toast.error(result.error.message || "Failed to send magic link"); return; } toast.success("Magic link sent! Check your email to complete setup."); } catch (error) { toast.error("An unexpected error occurred"); } finally { setIsLoading(false); } } return (
Complete Your Setup Your account was created by an administrator. Please link an authentication method to secure your account.

This is a one-time setup. After completing this step, you'll be able to sign in normally.

{/* Microsoft OAuth */} {/* Divider */}
Or use email
{/* Magic Link */}
); }