This commit implements a full-stack authentication system using JWT. On the backend, a new login endpoint `/api/token` is created. It validates credentials and issues a signed JWT. A JWT middleware is added to the server configuration to protect sensitive API endpoints like `/api/category` and `/api/operation`. Configuration is now managed via a `wallet.conf` file, loaded at startup. On the frontend, this enables a complete authentication lifecycle: - A new `/login` page allows users to enter their credentials. - A `PrivateRoute` component wraps protected pages, redirecting unauthenticated users to the login page. - API calls to protected resources now include the `Authorization: Bearer <token>` header. - A logout function is added to clear user session data. refactor(ui): enhance history and category views This commit also introduces major UI improvements. The History modal has been completely redesigned. Operations are no longer displayed as a flat list but are now grouped into tabs for Daily, Weekly, Monthly, and Yearly views, providing a much clearer overview of transactions. The Categories modal now separates categories into "Incomes" and "Expenses" tabs, reflecting the changes in the backend data model.
27 lines
837 B
AMPL
27 lines
837 B
AMPL
module backend
|
|
|
|
go 1.24.5
|
|
|
|
require (
|
|
github.com/gofiber/contrib/jwt v1.1.2
|
|
github.com/gofiber/fiber/v2 v2.52.9
|
|
github.com/golang-jwt/jwt v3.2.2+incompatible
|
|
github.com/joho/godotenv v1.5.1
|
|
)
|
|
|
|
require (
|
|
github.com/MicahParks/keyfunc/v2 v2.1.0 // indirect
|
|
github.com/andybalholm/brotli v1.1.0 // indirect
|
|
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
|
|
github.com/google/uuid v1.6.0 // indirect
|
|
github.com/klauspost/compress v1.17.9 // indirect
|
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
|
github.com/mattn/go-runewidth v0.0.16 // indirect
|
|
github.com/rivo/uniseg v0.2.0 // indirect
|
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
|
github.com/valyala/fasthttp v1.51.0 // indirect
|
|
github.com/valyala/tcplisten v1.0.0 // indirect
|
|
golang.org/x/sys v0.28.0 // indirect
|
|
)
|