add toggle for allowing registrations from the frontend
This commit is contained in:
@@ -6,6 +6,14 @@ const User = require('../models/User');
|
||||
// Register new user
|
||||
router.post('/register', async (req, res) => {
|
||||
try {
|
||||
// Check if registration is enabled
|
||||
const registrationEnabled = process.env.ALLOW_REGISTRATION !== 'false';
|
||||
if (!registrationEnabled) {
|
||||
return res.status(403).json({
|
||||
error: 'Registration is currently disabled'
|
||||
});
|
||||
}
|
||||
|
||||
const { username, email, password } = req.body;
|
||||
|
||||
// Check if user already exists
|
||||
|
||||
Reference in New Issue
Block a user