Skip to content

Commit

Permalink
Added log level to other log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
a-schild committed Mar 7, 2019
1 parent 572905b commit d17b270
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ctldap.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ function apiPost(site, func, data, triedLogin) {
}
return result.data;
}, function (error) {
console.log(error.message);
console.log("[ERROR] "+error.message);
console.log(error.stack);
});
}

Expand Down Expand Up @@ -342,7 +343,7 @@ function requestGroups (req, res, next) {
*/
function authorize(req, res, next) {
if (!req.connection.ldap.bindDN.equals(req.site.adminDn)) {
console.log("Rejected search without proper binding!");
console.log("[WARN] Rejected search without proper binding!");
return next(new ldap.InsufficientAccessRightsError());
}
return next();
Expand Down Expand Up @@ -381,8 +382,9 @@ function sendUsers (req, res, next) {
});
return next();
}).catch(function (error) {
console.log("Error while retrieving users: ");
console.log("[ERROR] Error while retrieving users: ");
console.log(error.message);
console.log(error.stack);
return next();
});
}
Expand All @@ -406,8 +408,9 @@ function sendGroups (req, res, next) {
});
return next();
}).catch(function (error) {
console.log("Error while retrieving groups: ");
console.log("[ERROR] Error while retrieving groups: ");
console.log(error.message);
console.log(error.stack);
return next();
});
}
Expand Down Expand Up @@ -444,7 +447,7 @@ function authenticate (req, res, next) {
}
return next();
} else {
console.log("Invalid root password!");
console.log("[WARN] Invalid root password!");
return next(new ldap.InvalidCredentialsError());
}
});
Expand All @@ -462,8 +465,9 @@ function authenticate (req, res, next) {
}
return next();
}).catch(function (error) {
console.log("Authentication error: ");
console.log("[WARN] Authentication error: ");
console.log(error.message);
console.log(error.stack);
return next(new ldap.InvalidCredentialsError());
});
}
Expand Down

0 comments on commit d17b270

Please sign in to comment.