# Auth forms (oxblade-adminlte)

> adminlte::auth.form renders the AdminLTE card for six authentication pages. It renders the form only: your application owns the routes, the controllers…

- Package: oxblade-adminlte (Rust, alpha), crates: `oxblade-adminlte`
- Maintenance: active; Latest release: 0.1.0 (2026-12-05); MSRV: Rust 1.99 or later; Licence: MIT
- Links: [Repository](https://github.com/bowerbird-si/oxblade-adminlte), [crates.io](https://crates.io/crates/oxblade-adminlte/0.1.0), [docs.rs](https://docs.rs/oxblade-adminlte/0.1.0), [Changelog](https://oss.bowerbird.si/oxblade-adminlte/docs/changelog/), [Contributing](https://github.com/bowerbird-si/oxblade-adminlte/blob/c4cc5d05f8707b760d95552ef70a05236193a07d/CONTRIBUTING.md), [Security policy](https://github.com/bowerbird-si/oxblade-adminlte/blob/c4cc5d05f8707b760d95552ef70a05236193a07d/SECURITY.md)
- Based on: [jeroennoten/laravel-adminlte](https://github.com/jeroennoten/Laravel-AdminLTE): The PHP package whose dashboard layout, menu, asset and plugin behavior this port follows.; [AdminLTE](https://github.com/ColorlibHQ/AdminLTE): The dashboard frontend used by applications. The crate does not bundle the distribution.
- PHP parity: core (30 covered, 18 diverged, 189 planned of 237 abilities; 30 fixtures; follows jeroennoten/laravel-adminlte v4.1.0; verified 2026-12-05)
- HTML version: https://oss.bowerbird.si/oxblade-adminlte/docs/auth-forms/
- Source: https://github.com/bowerbird-si/oxblade-adminlte/blob/c4cc5d05f8707b760d95552ef70a05236193a07d/docs/auth-forms.md

`adminlte::auth.form` renders the AdminLTE card for six authentication pages. It renders the form
only: your application owns the routes, the controllers, validation, rate limiting and CSRF checks.

| `AuthKind` | PHP view | Fields |
| --- | --- | --- |
| `SignIn` | `auth/login` | email, password, remember me |
| `Register` | `auth/register` | name, email, password, confirmation |
| `RequestReset` | `auth/passwords/email` | email |
| `ResetPassword { token }` | `auth/passwords/reset` | reset token (hidden), email, password, confirmation |
| `ConfirmPassword` | `auth/passwords/confirm` | password |
| `VerifyEmail` | `auth/verify` | none; a button that resends the email |

## Render a form

```rust
use laravel::view::view;
use oxblade_adminlte::{AuthForm, AuthKind, Layout};
use serde_json::json;

let form = AuthForm::new(AuthKind::SignIn, "/login".parse()?, &csrf_token)?;
let html = view(
    "adminlte::auth.form",
    json!({
        "layout": Layout::default().view("en"),
        "auth": form,
        "brand": "Example",
        "stylesheet_url": stylesheet,
    }),
)
.render()
.map_err(|error| std::io::Error::other(format!("{error:?}")))?;
```

`AuthForm::new` returns an error when:

- the action is not a rooted path on your own site (`/login` works, `https://…/login` and
  `/login#x` don't): `AuthFormError::InvalidAction`;
- the CSRF token, or the reset token for `ResetPassword`, is empty: `AuthFormError::MissingToken`.

Every form posts to the action you give it, with the token in a hidden `_token` field.

## After a failed submission

```rust
let form = AuthForm::new(AuthKind::Register, "/register".parse()?, &csrf_token)?
    .old(&old_name, &old_email, false)
    .with_error("email", "This email address is already registered.");
```

`old` refills name, email and the remember-me box. Passwords are never refilled. `with_error` puts a
plain-text message under one visible field and marks it with `aria-invalid` and
`aria-describedby`. Messages are escaped.

## Not included

- Translated titles and labels. The form text is English for now.
- The lock screen, the auth page layout options and the PHP auth routes.
- Links between the forms, such as "Forgot your password?" or "Register".

These are listed as planned in [`parity.toml`](https://github.com/bowerbird-si/oxblade-adminlte/blob/c4cc5d05f8707b760d95552ef70a05236193a07d/parity.toml).
