Skip to content

fix(auth): report a deactivated user's reset token as used - #592

Merged
cristim merged 2 commits into
mainfrom
fix/reset-token-status-deactivated-user
Oct 6, 2026
Merged

cristim merged 2 commits into
mainfrom
fix/reset-token-status-deactivated-user

Conversation

@cristim

@cristim cristim commented Oct 6, 2026

Copy link
Copy Markdown
Member

Closes #421

ResetTokenStatus now returns state used (flow reset) for an unexpired token of an admin-deactivated user, so the frontend shows the terminal view instead of a form that ConfirmPasswordReset refuses with 403. Expired tokens still report expired; no new existence oracle (deactivated is indistinguishable from unknown/consumed).

Tests: service unit test updated; new HandleRequest tests in internal/server (real auth.Service, mock store) for the status endpoint (fails before, passes after) and the confirm path (403).

ResetTokenStatus returned valid for an unexpired token belonging to an admin-deactivated user, so the frontend rendered a form that ConfirmPasswordReset always refuses with 403. Report used instead, matching unknown and consumed tokens so the endpoint does not reveal the deactivation.

Closes #421
@cristim cristim added triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/eventually No deadline impact/few Limited audience effort/s Hours type/bug Defect labels Oct 6, 2026
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 3 billable files and costs up to $0.75.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 49 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 64 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: LeanerCloud/cloud-commitments-platform/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 84f68dec-daf7-45e8-946f-ad2cd617a54c
📥 Commits

Reviewing files that changed from the base of the PR and between 165039d and 1915d5e.

📒 Files selected for processing (3)
  • internal/auth/service_password.go
  • internal/auth/service_password_test.go
  • internal/server/reset_token_status_deactivated_test.go
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

…onses

Pin expiry-before-deactivation ordering in ResetTokenStatus and compare status, headers and body between unknown and deactivated tokens.
@cristim
cristim merged commit 3de0c61 into main Oct 6, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/few Limited audience priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/bug Defect urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ResetTokenStatus reports a deactivated user's reset token as valid

1 participant