Repository navigation
How To Build a Sign Up Page
How to build a sign-up page of your own: a page for visitors only that asks for a username and a password typed
twice, asks to accept the terms, creates the account with the register_user capability the authentication module
ships, and signs the person in at once. One Route::page, one Route::form and a Pug view: no controller. Since
2.20.0 (same, accepted, signsIn, visitorsOnly).
/register of Route::auth already
asks for a username and a password and sends the person to /login; this page is for when you want more.
"A sign-up page at /join with the password typed twice and a terms box; it signs people in and sends them to /books"
Claude writes the two routes and the view below.
Check
-
/joinsends someone already signed in to/books. - Two different passwords and an empty box come back with a message under each, and the username stays.
- A right form lands on
/books, signed in.
Before you start: the authentication module (Auth::authentication('User', 'users'); and Route::auth(...) in
web.php).
-
The routes, in
application/config/routing/web.php, afterRoute::auth(...):Route::page('/join', 'Bookshelf/join', ['visitorsOnly' => '/books']); Route::form('/join', 'register_user', [ 'visitorsOnly' => '/books', 'same' => ['confirmpasscode' => ['passcode', 'The two passwords are not the same']], 'accepted' => ['terms' => 'Accept the terms of use to create an account'], 'signsIn' => 'id', 'success' => '/books', 'back' => '/join', 'flash' => 'Welcome to the Bookshelf', ]);
register_useranswers the new account, and'signsIn' => 'id'signs in the person whose id is in that field (a new session id and a new CSRF token, as forRoute::auth). -
The view,
application/views/Bookshelf/join.pug:extends ../default/master/site block content main.cq-auth h1 Join the Bookshelf if flash('error') .cq-alert.cq-alert--error(role='alert')= flash('error') form(method='POST', action=$home . 'join') =csrf() .cq-field label(for='username') Username input#username.form-control(type='text', name='username', value=old('username'), required) if errors('username') p.cq-field-error= errors('username') .cq-field label(for='passcode') Password input#passcode.form-control(type='password', name='passcode', required, autocomplete='new-password', maxlength='72') if errors('passcode') p.cq-field-error= errors('passcode') .cq-field label(for='confirmpasscode') The same password again input#confirmpasscode.form-control(type='password', name='confirmpasscode', required, autocomplete='new-password', maxlength='72') if errors('confirmpasscode') p.cq-field-error= errors('confirmpasscode') .cq-field label input(type='checkbox', name='terms', value='1') | I accept the terms of use if errors('terms') p.cq-field-error= errors('terms') button.btn.btn-primary(type='submit') Join
-
Try it. Sign out and open
http://localhost:8080/join. Send two different passwords and leave the box empty: the page comes back with "Some of the inputs are invalid", "The two passwords are not the same" under the second password and "Accept the terms of use to create an account" under the box, and the username is still there. Send the form right: you land on/books, signed in, with "Welcome to the Bookshelf" (whenbooks.pugshowsflash('success')). Open/joinagain: you are sent to/books.
Option of Route::form
|
Here |
|---|---|
visitorsOnly |
people already signed in go to /books, and the capability does not run |
same |
confirmpasscode must equal passcode; checked before the capability, its message in errors('confirmpasscode')
|
accepted |
the box terms must be ticked |
signsIn |
the field of the answer that holds the id of the person to sign in; signsInWith says how ('password' by default, for AuthRoutes::signedInBy()) |
success, back, flash
|
where a good form and a refused one go, and the message |
The checks run in this order: visitorsOnly, then (JSON with the session) the CSRF header, then same and accepted,
then the capability. All the options: Declarative routes: Route::form.
register_user accepts usernames of letters and digits (up to 100) and passwords of 8 to 72 characters, gives
permissions 0, and is refused over REST and MCP, so nobody can create accounts in bulk.
-
A username with a dot or an
@is refused:register_usertakes letters and digits (G75). For an email, see How to sign in with an email. -
The messages are gone on the next page (G129): they last one request;
backandsuccessmust be the pages that show them. -
Declaring
confirmpasscodein$rules:samereads it from what was sent; declare it only if the capability needs it. -
A field
register_user's$rulesdo not list never reaches it (G133).
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)