Skip to content

fix: set status to 'active' on user registration - #1346

Open
Kirtan-pc wants to merge 1 commit into
Nitya-003:mainfrom
Kirtan-pc:fix/user-registration-status
Open

fix: set status to 'active' on user registration#1346
Kirtan-pc wants to merge 1 commit into
Nitya-003:mainfrom
Kirtan-pc:fix/user-registration-status

Conversation

@Kirtan-pc

Copy link
Copy Markdown
Contributor

Summary

This PR fixes Issue #1228: newly registered users cannot log in because User.status defaults to "pending" and nothing in the codebase ever activates self-registered accounts. Both loginUser and walletLogin hard-reject non-active accounts, and the protect middleware blocks all authenticated routes for non-active users, leaving self-registered accounts permanently stuck.

Changes

  • registerUser (backend/controllers/authController.js:170-176): Added status: "active" to the User.create call so email/password registrations produce immediately usable accounts.
  • walletRegister (backend/controllers/authController.js:625-631): Added status: "active" to the User.create call so wallet-based registrations produce immediately usable accounts.

##Fixes #1228

Copilot Review Feedback

Other suggestions were evaluated but intentionally left unchanged because they are pre-existing issues outside the scope of Issue #1228:

Comment Verdict Reason
Change default status in User.js schema from "pending" to "active" Out of scope The "pending" default is intentional for admin-created accounts that require approval; only self-registration paths need immediate activation
Add email verification flow before activation Out of scope Pre-existing feature gap; introduces new infrastructure (email service, token storage) beyond a targeted bugfix
Add admin approval workflow for self-registered users Out of scope Pre-existing feature gap; would require new UI, endpoints, and notification system

Both registerUser and walletRegister created users without explicitly
setting status, so they inherited the schema default of 'pending'.
loginUser, walletLogin, and the protect middleware all reject non-active
accounts, making newly registered users unable to log in.

Set status: 'active' in both registration paths so self-registered
accounts are immediately usable.

Fixes Nitya-003#1228
@vercel

vercel Bot commented Aug 15, 2026

Copy link
Copy Markdown

@Kirtan-pc is attempting to deploy a commit to the Nitya Gosain's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

Registered users stuck pending and never log in

1 participant