-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Description
The application currently has authentication functionality with login and register features, but lacks a proper logout endpoint on the backend and a logout button in the dashboard UI. While the frontend has logout logic implemented in the auth context, we need:
- A backend logout endpoint following the project's hexagonal architecture
- A logout button in the dashboard header (top-right position) for easy access
Current State
- ✅ Frontend logout logic exists in
useAuthContext.tsx - ✅ Frontend auth service has logout function calling
/api/v1/auth/logout - ❌ Backend
/api/v1/auth/logoutendpoint is missing - ❌ Dashboard lacks visible logout button
Requirements
Backend
- Add
POST /api/v1/auth/logoutendpoint in/backend/src/infrastructure/web/routers/users.py - Follow hexagonal architecture patterns (use case → domain → infrastructure)
- Handle token invalidation/blacklisting if needed
- Return appropriate HTTP status codes
Frontend
- Add logout button to dashboard header (
/frontend/src/pages/home.page.tsx) - Position button in top-right corner of the header
- Use existing
useAuthContexthook for logout functionality - Ensure logout redirects to login page
- Follow project's feature-based architecture and UI conventions
Acceptance Criteria
- Backend endpoint
POST /api/v1/auth/logoutis implemented - Endpoint follows hexagonal architecture patterns
- Endpoint returns 200 status on successful logout
- Frontend dashboard has logout button in header top-right position
- Logout button uses existing auth context logout function
- Clicking logout button clears user session and redirects to
/login - Button follows project's UI design patterns (Radix UI/TailwindCSS)
- All existing authentication tests continue to pass
- New functionality includes appropriate error handling
Technical Notes
Backend Implementation
- Location:
/backend/src/infrastructure/web/routers/users.py - Should be added near existing auth endpoints (register, login)
- Consider if token blacklisting is needed for security
- Follow existing dependency injection patterns
Frontend Implementation
- Location:
/frontend/src/pages/home.page.tsxheader section - Use existing
useAuthContexthook:const { logout } = useAuthContext() - Style with TailwindCSS to match existing UI components
- Consider adding user email/avatar next to logout button
Priority
Medium - Important for user experience and security best practices
Metadata
Metadata
Assignees
Labels
No labels