Cmd/Ctrl + K

Build a login flow

This recipe uses Annabel auth, sessions, validation, CSRF protection, and route middleware.

Configure auth

For a database-backed provider:

The users table must contain the credential column and password hash column.

Routes

Expose the login form and session actions, then protect the dashboard with auth middleware.

Controller

The controller validates credentials, starts or ends the authenticated session, and redirects the user.

Form

Submit the credentials with a CSRF token and preserve only safe validation input.

Validation excludes sensitive fields such as password from flashed old input according to config/validation.php.