Skip to content

feat: show reset dialog box when user not found in DB#64

Open
xrvnd wants to merge 2 commits into
coder-zs-cse:mainfrom
xrvnd:feat/user-reset-dialogbox
Open

feat: show reset dialog box when user not found in DB#64
xrvnd wants to merge 2 commits into
coder-zs-cse:mainfrom
xrvnd:feat/user-reset-dialogbox

Conversation

@xrvnd

@xrvnd xrvnd commented May 27, 2026

Copy link
Copy Markdown
Contributor

Changes

Backend

  • Added validateUser() helper function in src/services/user/user.ts that checks DB if user exists
  • All puzzle API routes (/status, /hint, /check) now call validateUser before processing and returns 404 { error: "USER_NOT_FOUND" } if not found

Frontend

  • Axios response interceptor maps 404 USER_NOT_FOUND to regular Error("USER_NOT_FOUND") so we can differentiate errors
  • New UserResetDialog component overlays the game with an "Account not found" message and a Reset button, clicking it removes userId from localStorage and reloads the page
  • Fixed a pre existing bug: toast.error was being called during render in Daily page; lifted it to a useEffect

How to test/ Testing screenshots

Insert a fakeuser with a userId in the console.
Screenshot from 2026-05-27 13-13-26

Reload the /daily page and the reset dialog should appear. Click on Reset here.
Screenshot from 2026-05-27 13-10-03

localStorage.userId is cleared in the local storage
Screenshot from 2026-05-27 13-13-42

Closes #37

@vercel

vercel Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

@xrvnd is attempting to deploy a commit to the coderzs' projects Team on Vercel.

A member of the Team first needs to authorize it.

@coder-zs-cse

Copy link
Copy Markdown
Owner

Can u resolve merge conflicts. Also can we habe our puzzle theme for the dialog box colors

@xrvnd

xrvnd commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

Will get on this and push a fix

@xrvnd

xrvnd commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

PR is ready to review and merge.

Screenshot from 2026-05-28 08-53-47

Thought this would be a nice theme for the dialog box, let me know if we align on this. Or if you have something specific in mind I'll make those changes as well.

@xrvnd

xrvnd commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

@coder-zs-cse review please :)

@xrvnd

xrvnd commented May 30, 2026

Copy link
Copy Markdown
Contributor Author

hi @coder-zs-cse , bro review plis

@xrvnd

xrvnd commented May 31, 2026

Copy link
Copy Markdown
Contributor Author

@coder-zs-cse review please

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.

feat: handle stale userId in localStorage

2 participants