Commit Graph

11 Commits

Author SHA1 Message Date
6735d99df2 feat: implement customer authentication with JWT tokens
Implement secure customer authentication system with dedicated JWT tokens,
separate from admin/vendor authentication.

Backend Changes:
- Add customer JWT token support in deps.py
  - New get_current_customer_from_cookie_or_header dependency
  - Validates customer-specific tokens with type checking
  - Returns Customer object instead of User for shop routes
- Extend AuthService with customer token support
  - Add verify_password() method
  - Add create_access_token_with_data() for custom token payloads
- Update CustomerService authentication
  - Generate customer-specific JWT tokens with type="customer"
  - Use vendor-scoped customer lookup
- Enhance exception handler
  - Sanitize validation errors to prevent password leaks in logs
  - Fix shop login redirect to support multi-access routing
- Improve vendor context detection from Referer header
  - Consistent "path" detection method for cookie path logic

Schema Changes:
- Rename UserLogin.username to email_or_username for flexibility
- Update field validators accordingly

API Changes:
- Update admin/vendor auth endpoints to use email_or_username
- Customer auth already uses email field correctly

Route Changes:
- Update shop account routes to use Customer dependency
- Add /account redirect (without trailing slash)
- Change parameter names from current_user to current_customer

Frontend Changes:
- Update login forms to use email_or_username in API calls
- Change button text from "Log in" to "Sign in" for consistency
- Improve loading spinner layout with flexbox

Security Improvements:
- Customer tokens scoped to vendor_id
- Token type validation prevents cross-context token usage
- Password inputs redacted from validation error logs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 21:08:49 +01:00
92a2610b70 renaming properly all middleware test cases and fixing bugs 2025-11-19 21:21:29 +01:00
79dfcab09f frontend error management enhancement 2025-11-05 21:52:22 +01:00
9611c03a36 migrating vendor frontend to new architecture 2025-10-31 20:51:30 +01:00
5c80ba17c5 Main exception renamed to WizamartException 2025-10-27 21:55:05 +01:00
5be47b91a2 Working state before icon/utils fixes - Oct 22 2025-10-21 21:56:54 +02:00
0114b6c46e shop product refactoring 2025-10-04 23:38:53 +02:00
6b9817f179 test updates to take into account exception management 2025-09-27 13:47:36 +02:00
cea88a46c5 Marketplace tests update 2025-09-24 22:28:44 +02:00
98285aa8aa Exception handling enhancement 2025-09-23 22:42:26 +02:00
d9618cc7a6 Add custom exceptions handling 2025-09-21 21:48:48 +02:00