Make LDAP configuration optional
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
700b89524e
commit
7730ebb28b
@ -9,7 +9,12 @@ const router = express.Router();
|
|||||||
let userDB;
|
let userDB;
|
||||||
|
|
||||||
|
|
||||||
const ldap = new LdapAuth(config.get("ldap"));
|
let ldap;
|
||||||
|
if (config.has("ldap.url")) {
|
||||||
|
ldap = new LdapAuth(config.get("ldap"));
|
||||||
|
} else {
|
||||||
|
ldap = null;
|
||||||
|
}
|
||||||
|
|
||||||
require("../db/users").then(function(db) {
|
require("../db/users").then(function(db) {
|
||||||
userDB = db;
|
userDB = db;
|
||||||
@ -23,6 +28,9 @@ router.get("/", function(req, res/*, next*/) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function ldapPromise(username, password) {
|
function ldapPromise(username, password) {
|
||||||
|
if (!ldap) {
|
||||||
|
throw "LDAP not being used";
|
||||||
|
}
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
ldap.authenticate(username, password, function(error, user) {
|
ldap.authenticate(username, password, function(error, user) {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user