summaryrefslogtreecommitdiff
path: root/bin/manage_users
diff options
context:
space:
mode:
authorSheogorath2019-12-28 13:35:57 +0100
committerGitHub2019-12-28 13:35:57 +0100
commit472ae01546ac041657429fb8590c32b1794aff1c (patch)
tree93e585e9c2ebed7a50a7062e33b2ef85496065bb /bin/manage_users
parent1f1059d46cabfba5fa5c9cd319a52a7cbc8f0e8e (diff)
parentbb1c150698d52dd8099647eb5aa2739af960b849 (diff)
Merge pull request #235 from soerface/issue-234
Fix #234 - make manage_users work again
Diffstat (limited to 'bin/manage_users')
-rwxr-xr-xbin/manage_users8
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/manage_users b/bin/manage_users
index f744150d..7cce9726 100755
--- a/bin/manage_users
+++ b/bin/manage_users
@@ -36,9 +36,9 @@ function getPass(argv, action) {
async function createUser(argv) {
const existing_user = await models.User.findOne({where: {email: argv["add"]}});
// Cannot create already-existing users
- if(existing_user != undefined) {
+ if(existing_user) {
console.log(`User with e-mail ${existing_user.email} already exists! Aborting ...`);
- process.exit(1);
+ process.exit(2);
}
const pass = getPass(argv, "add");
@@ -57,7 +57,7 @@ async function createUser(argv) {
async function deleteUser(argv) {
// Cannot delete non-existing users
const existing_user = await models.User.findOne({where: {email: argv["del"]}});
- if(existing_user === undefined) {
+ if(!existing_user) {
console.log(`User with e-mail ${argv["del"]} does not exist, cannot delete`);
process.exit(1);
}
@@ -73,7 +73,7 @@ async function deleteUser(argv) {
async function resetUser(argv) {
const existing_user = await models.User.findOne({where: {email: argv["reset"]}});
// Cannot reset non-existing users
- if(existing_user == undefined) {
+ if(!existing_user) {
console.log(`User with e-mail ${argv["reset"]} does not exist, cannot reset`);
process.exit(1);
}