feat: protect write endpoints with JWT auth (story #08)
Add bcrypt user file auth, JWT middleware on all write routes, Pinia authStore with localStorage persistence, login view with redirect support, and v-if guards on all CRUD controls and admin nav link. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,15 +9,19 @@ A full-stack fruit-variety database (Go + Vue 3).
|
||||
- Administrators can bulk-import the legacy fruit database from XML using `scripts/import_fruits.py`, and then import all publications (cover images, linked fruits, PDFs, fruit images) using `scripts/import_publications.py`.
|
||||
- Users can search fruits by name or synonym (case-insensitive, debounced) and filter by type or combined-type alias (e.g. "Birnen- und Quittensorten") from the fruit list.
|
||||
- Users can manage publications (books, catalogues) with cover images, linked fruits, per-fruit PDF descriptions, and fruit images; fruit detail pages show publication descriptions and images.
|
||||
- Maintainers can log in with a username and password to access data-modifying operations; all write API endpoints and admin controls are protected behind JWT authentication.
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
cp .env.example .env # set credentials
|
||||
make dev-db # start Postgres (waits until healthy)
|
||||
make migrate-up # apply schema migrations
|
||||
make run-backend # Echo API on :3000
|
||||
make run-frontend # Vite dev server on :5000
|
||||
cp .env.example .env # set credentials
|
||||
cp backend/.env.example backend/.env # set JWT_SECRET and USERS_FILE
|
||||
cp users.env.example users.env # create user file (see below)
|
||||
./scripts/create_user.sh admin secret >> users.env # add a user
|
||||
make dev-db # start Postgres (waits until healthy)
|
||||
make migrate-up # apply schema migrations
|
||||
make run-backend # Echo API on :3000
|
||||
make run-frontend # Vite dev server on :5000
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
Reference in New Issue
Block a user