Skip to content

fix: display backend error on password reset failure (#504) - #538

Open
RounakKumarAgarwal wants to merge 1 commit into
AOSSIE-Org:mainfrom
RounakKumarAgarwal:fix/issue-504-reset-error-message
Open

RounakKumarAgarwal wants to merge 1 commit into
AOSSIE-Org:mainfrom
RounakKumarAgarwal:fix/issue-504-reset-error-message

Conversation

@RounakKumarAgarwal

@RounakKumarAgarwal RounakKumarAgarwal commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #504

The password-reset flow (confirmForgotPassword) read data.message, but the backend returns errors under data.error — so users saw a generic "Password update failed" instead of the specific reason (e.g. "Reset code has expired. Please request a new one.").

Now reads data.error first, falling back to data.message.

Changes

  • frontend/src/context/authContext.tsx: confirmForgotPassword now reads data.error || data.message || 'Password update failed'.

Related

Complements #471 (which applies the same fix to the login handler). This covers the password-reset case, which #471 doesn't touch — using the same data.error || data.message pattern for consistency.

Testing

  • npm run build — no new errors.
    Before
Screen.Recording.2026-09-16.182320.mp4

After

Screen.Recording.2026-09-16.184153.mp4

Summary by CodeRabbit

  • Bug Fixes
    • Improved password-reset error messages by showing the most specific available error detail, with a clear fallback message when no details are provided.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: f85aa574-1264-4543-a173-fc88d65a6168

📥 Commits

Reviewing files that changed from the base of the PR and between 9f90f9b and d87d378.

📒 Files selected for processing (1)
  • frontend/src/context/authContext.tsx

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The password reset confirmation error now uses the backend’s error field before checking message or using the generic fallback.

Changes

Password reset error handling

Layer / File(s) Summary
Reset error message fallback
frontend/src/context/authContext.tsx
confirmForgotPassword now throws the backend’s data.error value first, then data.message, and finally Password update failed.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: syedbarkath980

Merge Risk: ⚪ Minimal · up to d87d3

The password-reset flow now surfaces specific backend failures while retaining message and generic fallbacks, with no remaining merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: displaying backend errors when password reset confirmation fails.
Linked Issues check ✅ Passed Issue #504 requires confirmForgotPassword to surface data.error, then fall back to data.message, and then use Password update failed. The reviewed diff implements this exact precedence in `fro…
Out of Scope Changes check ✅ Passed The PR changes one error-selection expression in confirmForgotPassword, which directly addresses issue #504. The diff contains no unrelated source or configuration changes. All good on scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

[BUG]: Reset password form shows generic "Password update failed" instead of the backend's specific error (e.g. expired code)

1 participant