1
0
mirror of https://github.com/misterunknown/ifm.git synced 2025-08-09 17:46:31 +02:00
This commit is contained in:
Anton Baranov
2021-11-30 17:22:47 +02:00
parent 2bd7d2bcd7
commit dcc1247c59
2 changed files with 17 additions and 12 deletions

View File

@@ -1921,14 +1921,20 @@ function IFM(params) {
},
dataType: "json",
success: function(e) {
if (e.status != "ERROR") {
self.hideModal();
self.initApplication();
} else {
var errorlogin = document.getElementsByClassName('alert')[0];
errorlogin.classList.remove("d-none");
errorlogin.innerHTML = e.message;
}
},
error: function(e) {
var errorlogin = document.getElementsByClassName('alert')[0];
errorlogin.classList.remove("d-none");
errorlogin.innerHTML = "Authentication failed"
//self.showMessage("Authentication failed", "e");
errorlogin.innerHTML = "Authentication failed";
}
});
}
@@ -1937,10 +1943,6 @@ function IFM(params) {
self.initApplication();
}
}
// },
// error: function(resp) {
// throw new Error("Not authenticated");
// }
});
};

View File

@@ -1028,7 +1028,8 @@ f00bar;
}
$u = $uuid . "=" . $user . "," . $basedn;
if (!$ds = ldap_connect($ldap_server)) {
trigger_error("Could not reach the ldap server.", E_USER_ERROR);
throw new IFMException("Could not reach the ldap server." , true);
//trigger_error("Could not reach the ldap server.", E_USER_ERROR);
return false;
}
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
@@ -1036,16 +1037,18 @@ f00bar;
$ldbind = @ldap_bind($ds, $u, $pass);
if ($ldbind) {
if ($ufilter) {
if (ldap_count_entries($ds, ldap_search($ds, $u, $ufilter)) > 0) {
if (ldap_count_entries($ds, ldap_search($ds, $u, $ufilter)) == 1) {
$authenticated = true;
} else {
trigger_error("User not allowed.", E_USER_ERROR);
throw new IFMException("User not allowed." , true);
//trigger_error("User not allowed.", E_USER_ERROR);
$authenticated = false;
}
} else
$authenticated = true;
} else {
trigger_error(ldap_error($ds), E_USER_ERROR);
throw new IFMException(ldap_error($ds) , true);
//trigger_error(ldap_error($ds), E_USER_ERROR);
$authenticated = false;
}
ldap_unbind($ds);