This application includes a user approval system that controls whether new users can immediately access content or need manual admin approval.
Add the following environment variable to your .env file:
# User Approval Settings
# Set to 'true' to automatically approve new users, 'false' to require manual admin approval (default)
AUTO_APPROVE_USERS=falseAUTO_APPROVE_USERS=true: New users are automatically approved and can access content immediately after signing inAUTO_APPROVE_USERS=false(default): New users require manual approval by an admin before they can access content
- User signs in with Google/Discord OAuth
- User account is created with
approved: true - User can immediately access all content (subject to
limitedAccessrestrictions)
- User signs in with Google/Discord OAuth
- User account is created with
approved: false - User is redirected to an approval pending page
- Admin must manually approve the user through the admin panel
- Once approved, user can access content
Admins can manage user approvals through the admin panel:
- View Users: See all users and their approval status
- Approve Users: Manually approve pending users
- Reject Users: Revoke approval from users
- Limited Access: Set users to have limited access to content
.env.example: AddedAUTO_APPROVE_USERSconfiguration optionsrc/lib/MongoDBCustomAdapter.js: Modified user creation to respect auto-approval settingsrc/utils/autoApproval.js: Utility functions for checking approval settings
src/components/HOC/ApprovedUser.js: Higher-order component that redirects unapproved userssrc/components/Admin/ListRecords.js: Admin interface for managing user approvalssrc/lib/auth.ts: Authentication configuration and session management
- Admin users (defined in
ADMIN_USER_EMAILS) are always automatically approved regardless of theAUTO_APPROVE_USERSsetting - The approval system works in conjunction with the
limitedAccessflag for additional content restrictions - Users without approval cannot access any authenticated content
If you're enabling auto-approval on an existing installation:
- Set
AUTO_APPROVE_USERS=truein your environment - Existing unapproved users will still need manual approval
- Only new users created after the setting change will be auto-approved
To approve all existing users programmatically, you can run a database update:
// MongoDB query to approve all existing users
db.AuthenticatedUsers.updateMany(
{ approved: false },
{ $set: { approved: true } }
)