Skip to content

feat(auth): refactor auth controller with security improvements#320

Merged
BHUVANSH855 merged 2 commits into
AnthropicBots:mainfrom
zaibamachhaliya:feature/refactor-auth-controller
Jun 30, 2026
Merged

feat(auth): refactor auth controller with security improvements#320
BHUVANSH855 merged 2 commits into
AnthropicBots:mainfrom
zaibamachhaliya:feature/refactor-auth-controller

Conversation

@zaibamachhaliya

Copy link
Copy Markdown
Contributor

Fixes: #304

Changes

Security

  • Added rate limiting for OTP requests (max 3 per 5 minutes)
  • Added login lockout after 5 failed attempts (15 min lockout)
  • Removed plain text password storage from pendingSignups
  • Added proper password hashing before storing

New Features

  • Added logout endpoint with token cleanup
  • Added change password endpoint with current password verification

Validation

  • Added OTP format validation (must be 6 digits)
  • Added email verification check before password reset

Code Structure

  • Moved OTP expiry to environment variable (OTP_EXPIRY_MINUTES)
  • Added proper error handling for all database operations
  • Added session cleanup for failed verifications

Database

  • Added email_verified column tracking
  • Added last_login timestamp tracking

@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

@zaibamachhaliya is attempting to deploy a commit to the Bhuvansh's projects Team on Vercel.

A member of the Team first needs to authorize it.

@BHUVANSH855 BHUVANSH855 added SSoC26 Program label for Social Summer of Code Season 5. Merge Conflicts. PR has merge time conflicts, update your local branch and then re commit with updated changes. labels Jun 29, 2026
@zaibamachhaliya

Copy link
Copy Markdown
Contributor Author

I've resolved the conflicts. Please review again.

@BHUVANSH855 BHUVANSH855 added action: merge Pull Request is ready for merge. Hard Program's points label. and removed Merge Conflicts. PR has merge time conflicts, update your local branch and then re commit with updated changes. labels Jun 30, 2026
@BHUVANSH855 BHUVANSH855 merged commit 6a62c87 into AnthropicBots:main Jun 30, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge Pull Request is ready for merge. Hard Program's points label. SSoC26 Program label for Social Summer of Code Season 5.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Refactor auth controller and fix issues

2 participants