Repository navigation
Route Auth
Route::auth($options) declares the sign-in, sign-out and sign-up pages in one line, with the views of the
authentication module, and no controller. It goes after Auth::authentication('User', 'users'); in web.php. Since
2.19.0; level since 2.19.5, attemptsPerUser since 2.19.6, coming back after signing in since 2.20.0.
Auth::authentication('User', 'users');
Route::auth(['home' => '/books']);This page is about the declaration. Users, levels, tokens, password reset and the views are in Authentication.
"Add sign-in pages: after signing in, people land on /books."
Check before you say OK:
-
Auth::authentication('User', 'users');is aboveRoute::auth(...)and theuserstable exists; - a page only signed-in people open says
'signedIn' => true(and'comeBack' => trueto land back on it); - no controller and no closure was written for the sign-in.
-
The
userstable. Run:docker compose exec dev-box php caligrafer.php sql application/models/Auth/create_db.sql -
Turn on sign-in. In
application/config/routing/web.php, remove the//in front ofAuth::authentication('User', 'users');, and add below it:// sign-in pages: /login, /logout, /register, /notAuthorized Route::auth(['home' => '/books']);
-
Try it. Open
http://localhost:8080/register, create an account (a username, a password typed twice), then sign in on/login: you land on/books.
| Route | What it does |
|---|---|
GET /login |
the sign-in page (Auth/login); a signed-in person goes to home, or to ?return=
|
POST /login |
checks the identifier field and passcode; on success a new session id and a new CSRF token, then home, or the page of /login?return=
|
GET /logout, POST /logout
|
signs out (a new session id and CSRF token), then logout
|
GET /notAuthorized |
the page of people below the level a page needs (403) |
GET /register, POST /register
|
the sign-up page (Auth/register) and the register_user capability, then /login
|
POST /passkey/register/options, /passkey/register, /passkey/login/options, /passkey/login
|
with 'passkeys' => true only |
| Option | Default | What it does |
|---|---|---|
home |
'/' |
where people go after signing in (a signed-in person who opens /login goes there too) |
logout |
'/' |
where people go after signing out |
register |
true |
true: /register with the register_user capability; false: no sign-up; a capability name: yours |
identifier |
'username' |
the users column people sign in with, and the name of the sign-in field ('email') |
signInAfterRegister |
false |
true: a new account is signed in and goes to home instead of the sign-in page |
attempts, lock
|
5, 900
|
failed sign-ins per username and address before a 429, and the window in seconds |
attemptsPerUser |
0 (off) |
failed sign-ins of one username from any address before it is locked (2.19.6). Someone could lock a known username out on purpose: keep it high (20) |
level |
0 |
the lowest permission level that may sign in (2.19.5): below it, a sign-in is refused like a wrong password |
messages |
human words | what sign-in and sign-up say: invalid, locked (2.19.3, {minutes} is the wait), mismatch, register_invalid, register_taken, registered (2.19.4); the defaults are AuthRoutes::MESSAGES
|
views |
['login' => 'Auth/login', 'register' => 'Auth/register'] |
your own views |
prefix |
'' |
'/account' gives /account/login... (the shipped views post to /login: write your own) |
passkeys |
false |
true adds the passkey endpoints (passkeys) |
// a users table with an email column: people sign in with it, and are signed in right after signing up
Route::auth(['home' => '/books', 'identifier' => 'email', 'signInAfterRegister' => true]);
// only administrators may sign in, in your own words
Route::auth(['home' => '/admin', 'level' => 1, 'messages' => ['invalid' => 'This account cannot sign in here.']]);- Signing in and signing out give the person a new session id and a new CSRF token.
- The fifth failed sign-in for a username from one address within 15 minutes, and every one after it until the 15
minutes end, answers
429(2.19.3;messagessets your own words). - A JSON request with
X-CSRF-Tokengets200{"data":{"user":{"id":1,"username":"ada","permissions":0}}},401or429in JSON: a Vue app signs in with the same routes. - Sign-up sends the register capability every input its
$rulesdeclare; nothing else of the form reaches it. - After signing in, a person goes to
home, or to the page named by/login?return=/books/3(2.20.0). Only a path of this site is followed: another site, or//evil.example, is ignored.Route::pageandRoute::actionwith'comeBack' => truebuild that address for you. -
Route::authrecords how the session signed in,passwordorpasskey, forAuthRoutes::signedInBy()(2.21.3). -
Not in
Route::auth: password reset and face sign-in.'reset' => trueor'face' => truestops with an error. Password reset isRoute::pageandRoute::form; face sign-in isRoute::action.
-
Route::authwithoutAuth::authentication('User', 'users')above it: there is no user model to sign in with. -
'identifier' => 'email'with the shippedlogin.pug: the sign-in form posts a field named after the identifier, so the view needs anemailfield. For people who sign in with an email and no separate username, keep the address inusernameinstead (Signing in with an email). -
A
prefixwith the shipped views: they post to/login. Write your own views. -
comeBackwith areturn=you build by hand to another site: it is ignored, the person goes tohome.
- Authentication: users, levels, tokens, password reset
-
Pages:
Route::page:signedIn,level,comeBack,visitorsOnly -
Forms:
Route::form: a sign-up of your own withsignsIn - Face detection and face login
Caligrafy: Describe it. Approve it. Ship it. Your idea turned into a complete app: every feature built once, for web pages, Vue apps, a REST API and AI agents, and online.
Why Caligrafy: the benefits, the measurements, and what it is not yet
-
Quickstart with Claude: describe it, approve it, ship it
or the Quickstart: the same three steps by hand, in 5 minutes
- How Caligrafy works: the ideas in 5 minutes
- Your first capability: build a feature, page included
-
Capabilities in depth
-
#[Capability]: every option - Scheduled jobs: capabilities on a timer
- Notifications: web push and email
- Background jobs: capabilities run later
- Migrations: database changes, in order
- The cache
-
Testing your app
- Dependency injection
- Validation rules
-
Web pages
- Views and page components
- Design styles: another look, one setting
- Declarative routes: every request, in one line
-
Route::page·Route::form·Route::auth·Route::webhook·Route::download·Route::redirect·Route::action·Route::snap· capability routes - How to export a list as CSV
- Controllers: moving one to a declared route · how to, step by step
- Forms and helpers
-
Vue apps
-
Mobile and tablet
-
REST API
-
AI agents
-
Snap Cards and the assistant
- Payments: Stripe and crypto
- Face detection and face login
- OpenAI: chat and images · Assistants
- Open models: Llama, Mistral...
- Chatbots with Watson
- Machine learning in the browser
- Metadata and social cards · search and analytics
-
Putting it online: the production image, the database at every start
-
API reference: every class and method
-
Routing ·
Route·AuthRoutes· pages ·Controller· capabilities -
Data ·
Model·Query· sign-in · jobs ·Notify· payments · AI -
Interfaces · Snap ·
Snap\Cards·Snap\Conversation· testing · tooling · helper functions
-
Routing ·
-
Caligrafer: every command
- Project · build · data · agents · jobs and tests · maintenance · deploy
- Installation, configuration and Caligrafer
- Routing · Request · Controllers · Views
- Vue: flow of information · routes · validations
- Security and upgrading
- Release notes: 2.26 · 2.25 · 2.24 · 2.23 · 2.22 · 2.21 · 2.20 · 2.19 · 2.18 · 2.17 · 2.16 · 2.15 · 2.14 · 2.13 · 2.12 · 2.11 · 2.10 · 2.9 · 2.8 · 2.7 · 2.6 · 2.5 · 2.4 · 2.3 · 2.1 · October 2026 · changelog
- Testing Caligrafy (contributors)