LoginForm
Password login form. Handles the full credential-submit lifecycle:
- Email + password fields
- Optional “remember me” checkbox
- Surfaces server errors (rate limit, invalid creds, 2FA-required)
- If the server returns
requires_2fa, swaps in the TOTP code field and re-submits with the second factor.
Slots
forgotPasswordHref— link rendered next to the password inputbelowSubmit— slot for SSO buttons, “create account” link, etc.
On success: calls onSuccess(authResponse) and the AuthClient’s
snapshot transitions to authenticated (your <ProtectedRoute> /
<GuestOnly> wrappers will react automatically).
Usage
import { LoginForm } from '@rw3iss/auth-client/preact/forms';
<LoginForm forgotPasswordHref={"/forgot-password"} onSuccess={(resp) => navigate("/")} onError={(err) => console.error(err)} organizationId={currentOrgId}/>Props
| Name | Type | Description |
|---|---|---|
client | AuthClient | |
defaultEmail | string | Pre-fill the email field (e.g. from a magic link). |
forgotPasswordHref | string | Where the “Forgot password?” link points. Hide by omitting. |
belowSubmit | ComponentChildren | Slot rendered under the submit button — typically the SSO group. |
aboveForm | ComponentChildren | Slot rendered above the form. |
onSuccess | (resp: AuthResponse) => void | |
onError | (err: Error) => void | |
organizationId | string | |
className | string |