import { useState } from "react"; import { api } from "../api.js"; import { Button, ErrorNote, Field } from "../ui.jsx"; export default function Login({ onSignedIn, setupNeeded, agency, hasLogo }) { const [name, setName] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [confirm, setConfirm] = useState(""); const [busy, setBusy] = useState(false); const [error, setError] = useState(null); const [forgot, setForgot] = useState(false); const submit = async (e) => { e.preventDefault(); setError(null); if (setupNeeded && password !== confirm) return setError(new Error("The two passwords don't match.")); setBusy(true); try { if (setupNeeded) await api("/api/auth/setup", { method: "POST", body: { name, email, password, setupToken: new URLSearchParams(location.search).get("setup") || "" } }); else await api("/api/auth/login", { method: "POST", body: { email, password } }); onSignedIn(); } catch (err) { setError(err); setBusy(false); } }; return (
Quorla

Every client account, the team's work and the reports, in one place.

Plan, approve and publish to Instagram, Facebook, TikTok, YouTube, LinkedIn and more, with live numbers, AI-run audits and weekly plans, and reports your clients can read.

{agency ? `${agency} workspace · ` : ""}client data is confidential
{hasLogo ? {agency} : Quorla}

{setupNeeded ? "Create the admin account" : "Sign in"}

{setupNeeded ? "First run: this person can add the rest of the team from Settings." : "Use your agency email."}

{setupNeeded && ( setName(e.target.value)} required autoFocus /> )} setEmail(e.target.value)} required autoFocus={!setupNeeded} /> setPassword(e.target.value)} required minLength={setupNeeded ? 10 : undefined} /> {setupNeeded && ( setConfirm(e.target.value)} required /> )}
{!setupNeeded && (
{forgot ? (

Ask an admin to reset it in Settings → Team members. They'll give you a temporary password to sign in with, and you then choose your own.

) : ( )}
)}
); }