reset endpoint + frontend reset and login pages add

This commit is contained in:
2026-09-26 19:26:57 +03:00
parent 489014667c
commit bcdf2b5154
32 changed files with 294 additions and 38 deletions
+28
View File
@@ -13,6 +13,7 @@ A FastAPI project combining Excel and digital data ("The Great Excel project tha
- Redis — caching, rate limiting, token revocation
- RabbitMQ (aio-pika) — background email workers
- Jinja2 — HTML email templates
- Frontend: React 19, TypeScript, Vite, react-router-dom, CSS Modules (yarn)
- Docker, Ansible — deployment
## Architecture
@@ -30,6 +31,8 @@ src/
├── reports/ # reports
├── service/ # business logic (auth, users_crud, email sending)
└── web/ # routes (protected_routes)
frontend/ # React app (login / password-reset pages), see "Frontend"
```
Layers are connected top to bottom: `web → service → database → models`.
@@ -60,6 +63,31 @@ python daemon_run.py --all # all daemons enabled in configs/daemons.js
- Refresh token is stored in the DB as a SHA256 hash, with rotation and revocation support
- Passwords are hashed with bcrypt
- RBAC: direct user permissions + permissions via groups, checked through `require_permissions()`
- Login: `POST /protected/token` (OAuth2 form-data: `username` = email, `password`); returns the access token and sets the refresh token as an httpOnly cookie. Failed logins are rate-limited (5 per minute per IP)
- Password reset: `POST /protected/reset?email=...` generates a temporary password, saves it and queues an email with it (3 requests per 10 minutes per IP). The response is the same whether or not the email exists
- CORS: the allowed frontend origin is taken from the `FRONT_URL` variable in `configs/.env` (required, e.g. `http://localhost:5173`)
## Frontend
React + Vite app in `frontend/` (login and password-reset pages).
```bash
cd frontend
yarn install
yarn dev # http://localhost:5173
```
Environment variables for the frontend live in `frontend/configs/.env`
(Vite is configured to read them from there). Only variables prefixed with
`VITE_` are exposed to the browser code:
```text
VITE_BACKEND_URL=http://localhost:8000
```
The frontend calls the backend directly (no dev proxy), so `FRONT_URL` in the
backend's `configs/.env` must match the address the frontend runs on.
Restart `yarn dev` after changing either file.
## Testing