Auth — Two Factor
Anatomy
A composed application section with typed inputs and native HTML output.
maud_ui::blocks::auth::two_factor
Props
Generated from public Rust fields. Defaults are evaluated from the implementation.
| Prop | Type | Default | Description |
|---|---|---|---|
action | String | "/auth/2fa/verify" | POST target for the code-submit form. Submits field code. |
method | Method | Email | Delivery channel — used to pick the heading copy and icon. |
sent_to | String | "" | Masked/partial identifier for where the code went (e.g. "s***@acme.com" or "+1 (••) •••-4321"). Shown in the subheading so users see which destination to check. |
length | usize | 6 | OTP length. 6 is the ubiquitous default; 4 is common for PINs and cheaper SMS cases. |
error | Option<String> | None | Error banner shown above the OTP input — e.g. "That code was incorrect" or "Code expired; request a new one". |
resend_url | Option<String> | None | URL for the resend link. None hides the resend row (useful while a client-side cooldown is active — render the same block but with this None and a hint in footer_hint). |
footer_hint | Option<String> | None | Custom text below the OTP input, above the submit button. Typical use: cooldown hint ("Resend available in 23s") or channel-specific advice ("Check your spam folder"). |
cancel_url | Option<String> | None | URL for the "Cancel / use a different method" link at the bottom. None hides it. |
submit_label | String | "Verify" | Label for the submit button (default: "Verify"). |
Examples
Check your email
We sent a 6-digit code to s***@acme.com.
Accessibility
Supply meaningful labels, choose heading levels for the surrounding page, and preserve native link and form behavior. Keyboard focus follows document order. Motion honors reduced-motion preferences.