From f2bc391a201027a5786e2642674c2044403c28de Mon Sep 17 00:00:00 2001 From: Pinglei He <pingleihe@pingleitekiMacBook-Pro.local> Date: Thu, 21 Oct 2021 20:10:36 +0200 Subject: [PATCH] removed unused variables --- app/users.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/users.js b/app/users.js index dbb775b..308620a 100644 --- a/app/users.js +++ b/app/users.js @@ -1,21 +1,22 @@ -const MEMBERS = ['lej', 'gowoons', 'dog']; -const cetteVariableEstInutile = 'à supprimer'; +const MEMBERS = ["lej", "gowoons", "dog"]; // Check if an user is a member function isMember(login) { - return MEMBERS.includes(login); + return MEMBERS.includes(login); } // Check if an user is a valid administrator function adminStatus(login, password) { - if (login === process.env.ADMIN_USERNAME && password === process.env.ADMIN_PASSWORD) { - return { msg: `User ${login} is verified as an admin`, status: 200 }; - } else if(login === process.env.ADMIN_USERNAME) { - return { msg: `Wrong password for ${login} user`, status: 401 }; - } else { - return { msg: `User ${login} is not an admin`, status: 401 }; - } - console.log("Ce texte n'est jamais affiché") + if ( + login === process.env.ADMIN_USERNAME && + password === process.env.ADMIN_PASSWORD + ) { + return { msg: `User ${login} is verified as an admin`, status: 200 }; + } else if (login === process.env.ADMIN_USERNAME) { + return { msg: `Wrong password for ${login} user`, status: 401 }; + } else { + return { msg: `User ${login} is not an admin`, status: 401 }; + } } module.exports.isMember = isMember; -- GitLab