From 1542436e967676a6861986b86bdde04f971517a9 Mon Sep 17 00:00:00 2001 From: Isaac Abadi Date: Sun, 29 Nov 2020 18:37:16 -0500 Subject: [PATCH] Passwords now must be provided when registering a user --- backend/authentication/auth.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/authentication/auth.js b/backend/authentication/auth.js index f16fbf1..9fdc7e7 100644 --- a/backend/authentication/auth.js +++ b/backend/authentication/auth.js @@ -89,6 +89,12 @@ exports.registerUser = function(req, res) { return; } + if (plaintextPassword === "") { + res.sendStatus(400); + logger.error(`Registration failed for user ${userid}. A password must be provided.`); + return; + } + bcrypt.hash(plaintextPassword, saltRounds) .then(function(hash) { let new_user = generateUserObject(userid, username, hash);