What kscript make auth writes
kscript make auth writes or adds to these files:
| File | What it is |
|---|---|
routes/web.kscript (added to) |
The sign-in routes: a guest group for the forms and an auth group for the account page. |
routes/api.kscript (with --api, added to) |
POST /api/tokens and GET /api/me. |
controllers/accounts.kscript |
The controller: sign up, sign in, sign out, resets, the account page and tokens. |
requests/sign-up.kscript |
The SignUp type the sign-up form is checked against, imported by the controller. |
_components/*.kscript |
The components the pages are made of: the sign-in, sign-up and password forms, the account details, the passkey list and the API tokens. |
views/auth/*.html |
The pages: login, register, forgot-password, reset-password and account. Each holds a heading and its components. |
_layout.html |
A plain layout, only when the site has none. |
models/user.kscript |
The User model the users are kept in: a copy of KScript.Auth's, to change as your app needs (see Users in a model). With --passkeys its email and password are optional, because someone who signs up with a passkey has neither. |
kscript.json (added to) |
"types": { "password": { "min": 10 } }, the rule new passwords must meet, and "users": "User" in http.auth. |
It respects make.syntax and --syntax xml, the folders in paths (components go in paths.components), and the route files http.routes lists. It won't replace files or routes you already have unless you add --force, and --dry-run shows what it would do.