Login · Masuk
Sign in with email or phone number and password, behind Cloudflare Turnstile. No shell.
$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/screen-login.jsonWhen to use
- The sign-in page of the app (/login), for every role: "Email atau nomor HP" + password, behind Cloudflare Turnstile when the server has a sitekey.
- Accounts come only by invite (Undangan · Buat password). There is no sign-up and no reset flow.
When not to use
- First password after an invite → Undangan (the link from email or WhatsApp).
- A forgotten password → the person asks HR ("Lupa password? Hubungi HR."); HR sends a new invite ("Atur ulang password" on Karyawan · Detail · Akun login).
Built from
Usage
The screen is the page content only. Put it inside AppShell (once, in your layout) and pass your data.
Installation
Adds the screen, its parts and its types. The components it uses come with it (registry dependencies).
API
import { Login } from "@/components/screens/login/login"| Prop | Type | Default | Description |
|---|---|---|---|
company | string | – | The line under "Masuk ke MaHR". Left out on the first run (no company yet). |
logo | ReactNode | – | The brand mark at the top of the card (48; 40 on a phone). |
turnstile | ReactNode | – | The Cloudflare Turnstile slot (the real widget; 65 high while it loads). Leave it out when the server sends no sitekey. |
status | "idle" | "submitting" | "idle" | "Masuk" → "Masuk…" (the button keeps its width; a second Enter is ignored). |
error | LoginError | null | – | The answer of the last attempt; the screen owns the sentence. credentials (both fields red) · inactive · rate-limit (warning) · turnstile · turnstile-pending · network (danger). |
attempt | number | 0 | +1 on every failed answer: replays the shake; credentials → focus in Password. |
onSubmit | ({ identifier, password }) => void | – | Called only when both fields pass. identifier is normalised: an email lower-case, a phone number as 0812… digits (+62 / 62 → 0). |
defaultValues | { identifier?, password? } | – | Start values; the form keeps its own values. |
autoFocus | boolean | true | Focus "Email atau nomor HP" on load, pointer devices only (a phone keyboard would cover the page). |
minHeight | number | string | 100dvh | The gallery passes 900 (an iframe would copy a dvh height). |