mirror of https://github.com/xfarrow/blink
Allow/deny users to register
This commit is contained in:
parent
dd43439d5b
commit
827f6399e9
|
@ -10,4 +10,4 @@ POSTGRES_PASSWORD = postgres
|
|||
POSTGRES_PORT = 5432
|
||||
|
||||
# Application settings
|
||||
ALLOW_USER_REGISTRATION = true
|
||||
ALLOW_USER_REGISTRATION = false
|
|
@ -31,6 +31,10 @@ const jwt = require('jsonwebtoken');
|
|||
// POST
|
||||
async function registerPerson(req, res){
|
||||
|
||||
if (process.env.ALLOW_USER_REGISTRATION === 'false'){
|
||||
return res.status(403).json({error : "Users cannot register on this server"});
|
||||
}
|
||||
|
||||
// Ensure that the required fields are present before proceeding
|
||||
if (!req.body.display_name || !req.body.email || !req.body.password) {
|
||||
return res.status(400).json("Invalid request.");
|
||||
|
@ -54,7 +58,8 @@ async function registerPerson(req, res){
|
|||
date_of_birth: req.body.date_of_birth,
|
||||
available: req.body.available,
|
||||
enabled: true,
|
||||
place_of_living: req.body.place_of_living})
|
||||
place_of_living: req.body.place_of_living
|
||||
})
|
||||
.returning("id");
|
||||
|
||||
await tr('ActivationLink')
|
||||
|
|
Loading…
Reference in New Issue