Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔒 fix: resolve session persistence post password reset #5077

Merged
merged 6 commits into from
Dec 23, 2024

Conversation

berry-13
Copy link
Collaborator

@berry-13 berry-13 commented Dec 21, 2024

Summary

Closes #5072

Description:

  • 🎯 Objective: Enhance the session management system to resolve the bug where user sessions persist after a password reset, address potential security risks, and update the session handling logic for better account security
  • 🐛 Bug Fix: Ensures old sessions are invalidated upon password reset to prevent use with an outdated password, enhancing security

Key Changes:

  • 🏗️ Modularization: Created a new session.js for the session schema and updated relevant models to import this schema
  • 🛠️ Method Addition: Introduced createSession, findSession, updateExpiration, deleteSession, deleteAllUserSessions, generateRefreshToken, and countActiveSessions
  • ⚙️ Controllers & Services Update: Auth & User controllers, along with AuthService, now utilize these new methods for better session handling

Files Modified:

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • refactor

Testing

Test Configuration:

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • My changes do not introduce new warnings
  • Local unit tests pass with my changes
  • Any changes dependent on mine have been merged and published in downstream modules.

@danny-avila
Copy link
Owner

Thanks, please check failing tests next time

@danny-avila danny-avila merged commit bdb222d into main Dec 23, 2024
4 checks passed
@danny-avila danny-avila deleted the fix/password-reset-sessions branch December 23, 2024 10:12
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]: User sessions remain after password reset
2 participants