feat: avatar, account menu, and single sign-on from Go Loose
Signing in now starts at the sign-in screen and one button that hands the
browser to Go Loose, which returns to the welcome page. Nothing redirects to the
identity provider on its own any more: that fired on every anonymous visit and
read as a redirect loop rather than as a choice to sign in. The password form
remains only where the API reports that Go Loose login is not configured for the
host, because otherwise the application is unreachable on a bare localhost.
A person's picture is carried through from the Go Loose identity and rendered in
the account menu and on the profile page, with their initials as the fallback.
Two things make that fallback necessary rather than decorative: Go Loose retires a
picture key when a picture is replaced, so a link cached in a browser can be dead,
and most people have not uploaded one. The URL is deliberately not persisted
locally, since a stored key would keep failing after the picture changed.
The account menu is a disclosure rather than a hover menu: a real button with
aria-expanded, Escape and outside clicks closing it, and focus returning to the
trigger. It is not an ARIA menu, because its actions are a link and a button and
menuitem roles would strip the link semantics from one of them for no gain.
The account URL of the Go Loose identity is resolved on each sign-in and is read
from the live identity provider every time, which is also what makes it correct
after a picture change.
Depends on the Go Loose revision that serves avatar_url through
/connect/userinfo, so the picture URL reaches this application at all.
2026-10-05 21:50:06 +02:00
|
|
|
import { ArrowRight, CircleHelp, KeyRound, Sparkles } from 'lucide-react'
|
2026-09-20 08:08:16 +02:00
|
|
|
import { SyntheticEvent, useState } from 'react'
|
|
|
|
|
import Logo from '../../components/layout/Logo'
|
|
|
|
|
import { FormField } from '../../components/form'
|
|
|
|
|
import { ErrorAlert, errorMessage } from '../../components/actions'
|
|
|
|
|
import { api, authStorage } from '../../api/client'
|
|
|
|
|
|
feat: avatar, account menu, and single sign-on from Go Loose
Signing in now starts at the sign-in screen and one button that hands the
browser to Go Loose, which returns to the welcome page. Nothing redirects to the
identity provider on its own any more: that fired on every anonymous visit and
read as a redirect loop rather than as a choice to sign in. The password form
remains only where the API reports that Go Loose login is not configured for the
host, because otherwise the application is unreachable on a bare localhost.
A person's picture is carried through from the Go Loose identity and rendered in
the account menu and on the profile page, with their initials as the fallback.
Two things make that fallback necessary rather than decorative: Go Loose retires a
picture key when a picture is replaced, so a link cached in a browser can be dead,
and most people have not uploaded one. The URL is deliberately not persisted
locally, since a stored key would keep failing after the picture changed.
The account menu is a disclosure rather than a hover menu: a real button with
aria-expanded, Escape and outside clicks closing it, and focus returning to the
trigger. It is not an ARIA menu, because its actions are a link and a button and
menuitem roles would strip the link semantics from one of them for no gain.
The account URL of the Go Loose identity is resolved on each sign-in and is read
from the live identity provider every time, which is also what makes it correct
after a picture change.
Depends on the Go Loose revision that serves avatar_url through
/connect/userinfo, so the picture URL reaches this application at all.
2026-10-05 21:50:06 +02:00
|
|
|
const LOGIN_PATH = '/api/auth/login'
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The sign-in screen.
|
|
|
|
|
*
|
|
|
|
|
* Signing in happens at Go Loose, so the usual case is one button that hands the
|
|
|
|
|
* browser over to it and comes back to the welcome page. That also means a person
|
|
|
|
|
* who already signed in at another application passes straight through, because
|
|
|
|
|
* Go Loose recognises the session it already holds and issues a code without
|
|
|
|
|
* asking anything.
|
|
|
|
|
*
|
|
|
|
|
* The password form is only for a host where Go Loose login is not configured:
|
|
|
|
|
* the API answers /api/auth/session with 404 there, and without a fallback the
|
|
|
|
|
* application would be unreachable on a bare localhost. It is not offered where
|
|
|
|
|
* the identity provider is in charge.
|
|
|
|
|
*/
|
2026-09-20 08:08:16 +02:00
|
|
|
export function LoginPage({
|
|
|
|
|
onLogin,
|
|
|
|
|
sessionExpired,
|
feat: avatar, account menu, and single sign-on from Go Loose
Signing in now starts at the sign-in screen and one button that hands the
browser to Go Loose, which returns to the welcome page. Nothing redirects to the
identity provider on its own any more: that fired on every anonymous visit and
read as a redirect loop rather than as a choice to sign in. The password form
remains only where the API reports that Go Loose login is not configured for the
host, because otherwise the application is unreachable on a bare localhost.
A person's picture is carried through from the Go Loose identity and rendered in
the account menu and on the profile page, with their initials as the fallback.
Two things make that fallback necessary rather than decorative: Go Loose retires a
picture key when a picture is replaced, so a link cached in a browser can be dead,
and most people have not uploaded one. The URL is deliberately not persisted
locally, since a stored key would keep failing after the picture changed.
The account menu is a disclosure rather than a hover menu: a real button with
aria-expanded, Escape and outside clicks closing it, and focus returning to the
trigger. It is not an ARIA menu, because its actions are a link and a button and
menuitem roles would strip the link semantics from one of them for no gain.
The account URL of the Go Loose identity is resolved on each sign-in and is read
from the live identity provider every time, which is also what makes it correct
after a picture change.
Depends on the Go Loose revision that serves avatar_url through
/connect/userinfo, so the picture URL reaches this application at all.
2026-10-05 21:50:06 +02:00
|
|
|
ssoAvailable,
|
2026-09-20 08:08:16 +02:00
|
|
|
}: {
|
|
|
|
|
onLogin: () => void
|
|
|
|
|
sessionExpired: boolean
|
feat: avatar, account menu, and single sign-on from Go Loose
Signing in now starts at the sign-in screen and one button that hands the
browser to Go Loose, which returns to the welcome page. Nothing redirects to the
identity provider on its own any more: that fired on every anonymous visit and
read as a redirect loop rather than as a choice to sign in. The password form
remains only where the API reports that Go Loose login is not configured for the
host, because otherwise the application is unreachable on a bare localhost.
A person's picture is carried through from the Go Loose identity and rendered in
the account menu and on the profile page, with their initials as the fallback.
Two things make that fallback necessary rather than decorative: Go Loose retires a
picture key when a picture is replaced, so a link cached in a browser can be dead,
and most people have not uploaded one. The URL is deliberately not persisted
locally, since a stored key would keep failing after the picture changed.
The account menu is a disclosure rather than a hover menu: a real button with
aria-expanded, Escape and outside clicks closing it, and focus returning to the
trigger. It is not an ARIA menu, because its actions are a link and a button and
menuitem roles would strip the link semantics from one of them for no gain.
The account URL of the Go Loose identity is resolved on each sign-in and is read
from the live identity provider every time, which is also what makes it correct
after a picture change.
Depends on the Go Loose revision that serves avatar_url through
/connect/userinfo, so the picture URL reaches this application at all.
2026-10-05 21:50:06 +02:00
|
|
|
/** null until the API has said whether Go Loose login is configured here. */
|
|
|
|
|
ssoAvailable: boolean | null
|
2026-09-20 08:08:16 +02:00
|
|
|
}) {
|
|
|
|
|
const [loading, setLoading] = useState(false)
|
|
|
|
|
const [error, setError] = useState('')
|
|
|
|
|
|
feat: avatar, account menu, and single sign-on from Go Loose
Signing in now starts at the sign-in screen and one button that hands the
browser to Go Loose, which returns to the welcome page. Nothing redirects to the
identity provider on its own any more: that fired on every anonymous visit and
read as a redirect loop rather than as a choice to sign in. The password form
remains only where the API reports that Go Loose login is not configured for the
host, because otherwise the application is unreachable on a bare localhost.
A person's picture is carried through from the Go Loose identity and rendered in
the account menu and on the profile page, with their initials as the fallback.
Two things make that fallback necessary rather than decorative: Go Loose retires a
picture key when a picture is replaced, so a link cached in a browser can be dead,
and most people have not uploaded one. The URL is deliberately not persisted
locally, since a stored key would keep failing after the picture changed.
The account menu is a disclosure rather than a hover menu: a real button with
aria-expanded, Escape and outside clicks closing it, and focus returning to the
trigger. It is not an ARIA menu, because its actions are a link and a button and
menuitem roles would strip the link semantics from one of them for no gain.
The account URL of the Go Loose identity is resolved on each sign-in and is read
from the live identity provider every time, which is also what makes it correct
after a picture change.
Depends on the Go Loose revision that serves avatar_url through
/connect/userinfo, so the picture URL reaches this application at all.
2026-10-05 21:50:06 +02:00
|
|
|
function beginExternalLogin() {
|
|
|
|
|
setLoading(true)
|
|
|
|
|
// A full navigation, not a router push: Go Loose answers with a redirect
|
|
|
|
|
// chain across two origins that the router has no part in.
|
|
|
|
|
window.location.assign(LOGIN_PATH)
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-20 08:08:16 +02:00
|
|
|
async function submit(event: SyntheticEvent<HTMLFormElement>) {
|
|
|
|
|
event.preventDefault()
|
|
|
|
|
setLoading(true)
|
|
|
|
|
setError('')
|
|
|
|
|
const form = new FormData(event.currentTarget)
|
|
|
|
|
try {
|
|
|
|
|
const auth = await api.login(String(form.get('email')), String(form.get('password')))
|
|
|
|
|
authStorage.save(auth)
|
|
|
|
|
onLogin()
|
|
|
|
|
} catch (requestError) {
|
|
|
|
|
setError(errorMessage(requestError))
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<main className="login-shell">
|
|
|
|
|
<section className="login-story">
|
|
|
|
|
<Logo />
|
|
|
|
|
<div className="story-copy">
|
|
|
|
|
<span className="eyebrow">Better hiring, clearly connected</span>
|
|
|
|
|
<h1>Find the right person for every journey.</h1>
|
|
|
|
|
<p>Bring roles, assessments, and candidate insight together in one workspace.</p>
|
|
|
|
|
<div className="story-stat">
|
|
|
|
|
<Sparkles />
|
|
|
|
|
<span>
|
|
|
|
|
<strong>Skills-first matching</strong>
|
|
|
|
|
<small>Structured signals for confident decisions</small>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p className="login-foot">Designed for fair, collaborative recruitment.</p>
|
|
|
|
|
</section>
|
|
|
|
|
<section className="login-panel" aria-labelledby="login-title">
|
|
|
|
|
<div className="login-card">
|
|
|
|
|
<span className="eyebrow">Welcome back</span>
|
|
|
|
|
<h2 id="login-title">Sign in to your workspace</h2>
|
|
|
|
|
{sessionExpired && (
|
|
|
|
|
<div className="session-notice" role="status">
|
|
|
|
|
Your session is no longer active. Sign in again to continue.
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
feat: avatar, account menu, and single sign-on from Go Loose
Signing in now starts at the sign-in screen and one button that hands the
browser to Go Loose, which returns to the welcome page. Nothing redirects to the
identity provider on its own any more: that fired on every anonymous visit and
read as a redirect loop rather than as a choice to sign in. The password form
remains only where the API reports that Go Loose login is not configured for the
host, because otherwise the application is unreachable on a bare localhost.
A person's picture is carried through from the Go Loose identity and rendered in
the account menu and on the profile page, with their initials as the fallback.
Two things make that fallback necessary rather than decorative: Go Loose retires a
picture key when a picture is replaced, so a link cached in a browser can be dead,
and most people have not uploaded one. The URL is deliberately not persisted
locally, since a stored key would keep failing after the picture changed.
The account menu is a disclosure rather than a hover menu: a real button with
aria-expanded, Escape and outside clicks closing it, and focus returning to the
trigger. It is not an ARIA menu, because its actions are a link and a button and
menuitem roles would strip the link semantics from one of them for no gain.
The account URL of the Go Loose identity is resolved on each sign-in and is read
from the live identity provider every time, which is also what makes it correct
after a picture change.
Depends on the Go Loose revision that serves avatar_url through
/connect/userinfo, so the picture URL reaches this application at all.
2026-10-05 21:50:06 +02:00
|
|
|
<p className="muted">
|
|
|
|
|
Use your work account to continue. If you are already signed in elsewhere, this takes
|
|
|
|
|
you straight through.
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
{ssoAvailable === false ? (
|
|
|
|
|
<form onSubmit={submit} className="stack-form">
|
|
|
|
|
<p className="muted">
|
|
|
|
|
Single sign-on is not configured for this host. Sign in with a local account.
|
|
|
|
|
</p>
|
|
|
|
|
<FormField label="Email address" htmlFor="email">
|
|
|
|
|
<input id="email" name="email" type="email" autoComplete="email" required />
|
|
|
|
|
</FormField>
|
|
|
|
|
<FormField label="Password" htmlFor="password">
|
|
|
|
|
<input
|
|
|
|
|
id="password"
|
|
|
|
|
name="password"
|
|
|
|
|
type="password"
|
|
|
|
|
autoComplete="current-password"
|
|
|
|
|
required
|
|
|
|
|
/>
|
|
|
|
|
</FormField>
|
|
|
|
|
{error && <ErrorAlert message={error} />}
|
|
|
|
|
<button className="button primary wide" type="submit" disabled={loading}>
|
|
|
|
|
{loading ? 'Signing in…' : 'Sign in'} <ArrowRight size={18} />
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
) : (
|
|
|
|
|
<div className="stack-form">
|
|
|
|
|
<button
|
|
|
|
|
className="button primary wide"
|
|
|
|
|
type="button"
|
|
|
|
|
onClick={beginExternalLogin}
|
|
|
|
|
disabled={loading}
|
|
|
|
|
>
|
|
|
|
|
{loading ? 'Redirecting…' : 'Sign in with Go Loose'} <KeyRound size={18} />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
2026-09-20 08:08:16 +02:00
|
|
|
<p className="demo-note">
|
|
|
|
|
<CircleHelp size={16} /> Contact your administrator for access.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
</main>
|
|
|
|
|
)
|
|
|
|
|
}
|