summaryrefslogtreecommitdiff
path: root/app/Auth
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-01-19 21:49:01 -0500
committerFrederic Guillot <fred@kanboard.net>2015-01-19 21:49:01 -0500
commit0d80102c4837ccd01edfec948b59be97385c6a16 (patch)
tree718a1f4b8200a0dea53b54025118b5ca14196224 /app/Auth
parent525d31d1bf485552330222049b630345814c9b44 (diff)
Minor code improvements for the pull-request
Diffstat (limited to 'app/Auth')
-rw-r--r--app/Auth/Ldap.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/app/Auth/Ldap.php b/app/Auth/Ldap.php
index 22c9fb88..dbf12387 100644
--- a/app/Auth/Ldap.php
+++ b/app/Auth/Ldap.php
@@ -208,27 +208,31 @@ class Ldap extends Base
}
/**
- * Retrieve info on LDAP user.
+ * Retrieve info on LDAP user
*
- * @param resource $ldap LDAP connection
* @param string $username Username
* @param string $email Email address
*/
public function lookup($username = null, $email = null)
{
- if ($username && $email)
+ if ($username && $email) {
$query = '(&('.sprintf(LDAP_USER_PATTERN, $username).')('.sprintf(LDAP_ACCOUNT_EMAIL, $email).')';
- else if ($username)
+ }
+ else if ($username) {
$query = sprintf(LDAP_USER_PATTERN, $username);
- else if ($email)
+ }
+ else if ($email) {
$query = '('.LDAP_ACCOUNT_EMAIL.'='.$email.')';
- else
+ }
+ else {
return false;
+ }
// Connect and attempt anonymous bind
$ldap = $this->connect();
- if (!is_resource($ldap) || !$this->bind($ldap, null, null))
+ if (! is_resource($ldap) || ! $this->bind($ldap, null, null)) {
return false;
+ }
// Try to find user
$sr = @ldap_search($ldap, LDAP_ACCOUNT_BASE, $query, array(LDAP_ACCOUNT_FULLNAME, LDAP_ACCOUNT_EMAIL, LDAP_ACCOUNT_ID));
@@ -244,7 +248,7 @@ class Ldap extends Base
}
// User id not retrieved: LDAP_ACCOUNT_ID not properly configured
- if (!$username && !isset($info[0][LDAP_ACCOUNT_ID][0])) {
+ if (! $username && ! isset($info[0][LDAP_ACCOUNT_ID][0])) {
return false;
}