diff --git a/web/app/login/page.tsx b/web/app/login/page.tsx index faf3be8..af10142 100644 --- a/web/app/login/page.tsx +++ b/web/app/login/page.tsx @@ -7,112 +7,105 @@ import { Button, Card } from "@/components/ui"; import { Logo } from "@/components/Logo"; export default function LoginPage() { - const [email, setEmail] = useState(""); - const [password, setPassword] = useState(""); - const [orgName, setOrgName] = useState(""); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [orgName, setOrgName] = useState(""); - useEffect(() => { - (async () => { - try { - const s = await auth.bootstrapStatus(); - if (s.needs_setup) { - window.location.href = "/setup"; - return; - } - if (s.org_name) setOrgName(s.org_name); - } catch { - - } - try { - await auth.me(); - window.location.href = "/"; - } catch { - - } - })(); - }, []); + useEffect(() => { + (async () => { + try { + const s = await auth.bootstrapStatus(); + if (s.needs_setup) { + window.location.href = "/setup"; + return; + } + if (s.org_name) setOrgName(s.org_name); + } catch {} + try { + await auth.me(); + window.location.href = "/"; + } catch {} + })(); + }, []); - const { mutate: signIn, isPending, error } = useMutation({ - mutationFn: () => auth.login(email, password), - onSuccess: () => { - window.location.href = "/"; - }, - }); + const { + mutate: signIn, + isPending, + error, + } = useMutation({ + mutationFn: () => auth.login(email, password), + onSuccess: () => { + window.location.href = "/"; + }, + }); - function handleSubmit(e: React.FormEvent) { - e.preventDefault(); - signIn(); - } + function handleSubmit(e: React.FormEvent) { + e.preventDefault(); + signIn(); + } - return ( -
-
-
- -

- {orgName ? `Sign in to ${orgName}` : "Sign in to Vantage"} -

+ return ( +
+
+
+ +

Sign in to Vantage

+

Organisation: {orgName}

+
+ + +
+
+ + setEmail(e.target.value)} + className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent/50 focus:outline-none focus:ring-1 focus:ring-accent/30" + /> +
+ +
+ + setPassword(e.target.value)} + className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent/50 focus:outline-none focus:ring-1 focus:ring-accent/30" + /> +
+ + {error &&
{(error as Error).message}
} + + +
+ +
+
+ or +
+
+ + + + +

SSO must be enabled for this organization by an administrator.

+ +
- - -
-
- - setEmail(e.target.value)} - className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent/50 focus:outline-none focus:ring-1 focus:ring-accent/30" - /> -
- -
- - setPassword(e.target.value)} - className="w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent/50 focus:outline-none focus:ring-1 focus:ring-accent/30" - /> -
- - {error && ( -
- {(error as Error).message} -
- )} - - -
- -
-
- or -
-
- - - - -

- SSO must be enabled for this organization by an administrator. -

- -
-
- ); + ); }