No need to try checking for LDAPAUTH_USERNAME_FIELD without lowercasing. PHP manual confirms array index is always lower case

This commit is contained in:
Chris Hastie 2016-07-22 10:43:03 +01:00
parent a7fe07614a
commit 7c1f6be501
1 changed files with 2 additions and 5 deletions

View File

@ -148,11 +148,8 @@ function ldapauth_is_valid_user( $value ) {
if (!$in_group) die('Not in admin group');
}
$username = $searchResult[0][LDAPAUTH_USERNAME_FIELD][0];
if (empty($username)) {
// try with it lower cased
$username = $searchResult[0][strtolower(LDAPAUTH_USERNAME_FIELD)][0];
}
// attribute index returned by ldap_get_entries is lowercased (http://php.net/manual/en/function.ldap-get-entries.php)
$username = $searchResult[0][strtolower(LDAPAUTH_USERNAME_FIELD)][0];
yourls_set_user($username);
if (LDAPAUTH_ADD_NEW && !array_key_exists($username, $yourls_user_passwords)) {