Disable registration

This commit is contained in:
Chord 2019-12-30 14:36:11 -05:00
parent d36fbbde9a
commit 3c5482a4c7
3 changed files with 7 additions and 1 deletions

View file

@ -7,7 +7,10 @@ api.post('/register', async (req, res, next) => {
const rUsername = req.body.username;
const rPassword = req.body.password;
const rEmail = req.body.email; // TODO: validate email regex
// TODO: recaptcha, csrf protection
res.status(403).json({message: "Registration is disabled"});
return;
if (!rUsername || !rPassword || !rEmail) {
res.status(400).json({message: "missing fields"});

View file

@ -50,6 +50,8 @@
alert.message("Unknown server error. Contact an administrator if this persists.")
} else if (e.response.status === 400) {
alert.message(e.response.data.message)
} else if (e.response.status === 403) {
alert.message(e.response.data.message)
} else {
alert.message("Unknown server error status");
}

View file

@ -7,7 +7,8 @@
"scripts": {
"build": "cross-env NODE_ENV=production webpack --config webpack.config.cjs",
"dev": "webpack-dev-server --history-api-fallback --config webpack.config.cjs --content-base public",
"dev-server": "nodemon -w api/ -w index.js"
"dev-server": "nodemon -w api/ -w index.js",
"production": "npm run build && node index.js"
},
"repository": {
"type": "git",