Skip to content
rw3iss Auth

LoginForm

form @rw3iss/auth-client/preact/forms/LoginForm framework-adapters/preact/components/forms/LoginForm.tsx ↗

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 input
    • belowSubmit — 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

NameTypeDescription
clientAuthClient
defaultEmailstringPre-fill the email field (e.g. from a magic link).
forgotPasswordHrefstringWhere the “Forgot password?” link points. Hide by omitting.
belowSubmitComponentChildrenSlot rendered under the submit button — typically the SSO group.
aboveFormComponentChildrenSlot rendered above the form.
onSuccess(resp: AuthResponse) => void
onError(err: Error) => void
organizationIdstring
classNamestring