Skip to content

12419 fix rerequesting pwd reset after an approved request has expired#105

Merged
giregk merged 2 commits into
rgsystemes:fix-12419-rerequesting-pwd-reset-after-approved-expired-requestfrom
giregk:12419-fix-rerequesting-pwd-reset-after-approved-expired-request
Jun 18, 2026
Merged

12419 fix rerequesting pwd reset after an approved request has expired#105
giregk merged 2 commits into
rgsystemes:fix-12419-rerequesting-pwd-reset-after-approved-expired-requestfrom
giregk:12419-fix-rerequesting-pwd-reset-after-approved-expired-request

Conversation

@giregk

@giregk giregk commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the password reset request flow to avoid reusing expired password reset authorizations by filtering out expired reset_token_expiration_date records at query time, and removes the previous “expired token” handling branches in the route handler.

Changes:

  • Filters the password_reset_request lookup to only return requests with a non-expired reset_token_expiration_date (or NULL).
  • Removes the server-side logic that regenerated tokens / restarted requests when an existing request was expired.
Comments suppressed due to low confidence (1)

src/api2/routes/passwordReset/requestPasswordReset.ts:133

  • When manual validation is disabled, resetRequest can still be a PENDING_ADMIN_CHECK row (or any non-COMPLETED row) because the earlier SELECT does not filter by status/reset_token and explicitly allows reset_token_expiration_date IS NULL. In that case resetRequest.reset_token / resetRequest.reset_token_expiration_date may be null, but sendPasswordResetRequestEmail() requires a non-null token and a Date expiration, so this path can throw (or send a malformed email) instead of generating a new token.
      } else {
        await sendPasswordResetRequestEmail(
          safeBody.userEmail,
          authDbRes.rows[0].device_name,
          resetRequest.reset_token,
          resetRequest.reset_token_expiration_date,
          acceptLanguage,
        );

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/api2/routes/passwordReset/requestPasswordReset.ts
@giregk giregk merged commit 44d0804 into rgsystemes:fix-12419-rerequesting-pwd-reset-after-approved-expired-request Jun 18, 2026
1 check passed
@giregk giregk deleted the 12419-fix-rerequesting-pwd-reset-after-approved-expired-request branch June 18, 2026 09:06
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.

3 participants