Skip to content

Add user login feature#22

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1778684187-add-user-login
Open

Add user login feature#22
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1778684187-add-user-login

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented May 13, 2026

Summary

Adds a user login feature to the Wordle app. Users can log in via a modal dialog accessible from the header, and their login state is persisted across sessions using localStorage.

Changes

  • AuthContext (src/context/AuthContext.js): New React context providing user, login, and logout state, persisted to localStorage via the existing useLocalStorage hook.
  • LoginModal (src/components/LoginModal/): Modal with username/password form, styled consistently with the existing app theme (dark mode, high contrast support).
  • Header: Added login icon (person circle) for logged-out users, and username display + logout icon for logged-in users.
  • App.jsx: Integrated the LoginModal state and passed it to the Header.
  • index.js: Wrapped the app with AuthProvider.
  • App.test.jsx: Fixed the test to wrap App with required context providers and test for actual content.

Screenshots

Login Modal:
Login Modal

Logged-in State (username in header):
Logged In

Review & Testing Checklist for Human

  • Verify login modal opens when clicking the person icon in the header
  • Verify username displays in the header after logging in
  • Verify logout button clears the user and shows the login icon again
  • Verify login state persists after page refresh (localStorage)
  • Verify the login modal works in both dark and light modes

Notes

  • This is a client-side-only login (no backend authentication). Any username/password combination is accepted. This is suitable for a game app where login serves as a user identity feature rather than a security mechanism.
  • The auth state is stored in localStorage under the key wordleUser.

Link to Devin session: https://app.devin.ai/sessions/93701e9af3af440a924d5eeccec4af34
Requested by: @shahmir-masood


Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)

- Create AuthContext with login/logout state persisted to localStorage
- Add LoginModal component with username/password form
- Update Header with login/user icon and logout button
- Display logged-in username in the header
- Wrap app with AuthProvider in index.js
- Fix test to use proper context providers

Co-Authored-By: shahmir.masood <shahmir.masood@cognition.ai>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration
Copy link
Copy Markdown
Author

End-to-End Test Results

Ran the app locally (npm start on localhost:3000) and tested the full login/logout flow via the browser UI.

All 5 tests passed.

Login Feature Tests
Test Result
Login icon shown when logged out + empty form validation Passed
Successful login shows username in header Passed
Login state persists after page refresh Passed
Logout clears state (persists after refresh) Passed
Login modal renders correctly in light mode Passed
Evidence Screenshots

Logged-out state (precondition):
Logged out

Empty form validation — "Please enter a username":
Validation

Logged in — "testuser" in header:
Logged in

Persists after refresh:
Persisted

Logout clears state:
Logged out after logout

Light mode modal:
Light mode

Devin session

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.

0 participants