Skip to content

Conversation

Layyzyy
Copy link

@Layyzyy Layyzyy commented Oct 14, 2025

Description

This PR fixes issue #16 by implementing functionality to display user details (username, email, and number of attacks run) on the UI when the user is logged in.

Changes Made

Backend (auth-server)

  1. handlers.go: Added getUserInfoHandler function that:

    • Fetches user details from the database using the authenticated user ID
    • Counts the number of reports/attacks for the user
    • Returns user information including username, email, attacks count, and other relevant details
  2. main.go: Added new route /api/auth/getUserInfo with authentication middleware

Frontend

  1. Navbar.jsx:
    • Added useEffect to fetch user data when component mounts
    • Updated API call to use the new /api/auth/getUserInfo endpoint
    • Display fetched user details (username, email, attacks count) in the profile card
    • Replaced hardcoded placeholder values with actual user data

Testing

  • Tested user login flow
  • Verified user details are fetched and displayed correctly
  • Confirmed attacks count is accurately reflected

Fixes

Closes #16

@Layyzyy
Copy link
Author

Layyzyy commented Oct 14, 2025

Please have a review in the code and please accept the merge request and also add the hacktoberfest label
Thank You !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: no user details is visible on the UI even when the user is logged in

1 participant