diff --git a/src/AdldapAuthUserProvider.php b/src/AdldapAuthUserProvider.php index 5c92436..d5ea898 100644 --- a/src/AdldapAuthUserProvider.php +++ b/src/AdldapAuthUserProvider.php @@ -144,7 +144,7 @@ protected function authenticate($username, $password) protected function authenticateWithCredentials(array $credentials = []) { $username = $this->getUsernameFromCredentials($credentials); - + // Make sure we're connected to our LDAP server before we run any operations. if ($this->isConnected() && !empty($username)) { // Due to having the ability of choosing which attribute we login users diff --git a/src/Traits/ImportsUsers.php b/src/Traits/ImportsUsers.php index 91a5465..69e5c43 100644 --- a/src/Traits/ImportsUsers.php +++ b/src/Traits/ImportsUsers.php @@ -249,7 +249,7 @@ protected function getAdldap($provider = null) protected function getUsernameFromAdUser(User $user) { $username = $user->{$this->getLoginAttribute()}; - + if (is_array($username)) { // We'll make sure we retrieve the users first username // attribute if it's contained in an array. diff --git a/tests/AdldapTest.php b/tests/AdldapTest.php index d1cf99c..1cff1f9 100644 --- a/tests/AdldapTest.php +++ b/tests/AdldapTest.php @@ -2,11 +2,11 @@ namespace Adldap\Laravel\Tests; -use Adldap\Models\User; use Adldap\Connections\Ldap; use Adldap\Contracts\AdldapInterface; use Adldap\Laravel\Facades\Adldap; use Adldap\Laravel\Tests\Models\User as EloquentUser; +use Adldap\Models\User; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; @@ -40,8 +40,8 @@ public function test_auth_passes($credentials = null) $credentials = $credentials ?: ['email' => 'jdoe@email.com', 'password' => '12345']; $user = $this->getMockUser([ - 'cn' => '', - 'mail' => 'jdoe@email.com', + 'cn' => '', + 'mail' => 'jdoe@email.com', 'samaccountname' => 'jdoe', ]); @@ -90,8 +90,8 @@ public function test_auth_passes_without_persistent_adldap_user() public function test_auth_fails_when_user_found() { $user = $this->getMockUser([ - 'cn' => '', - 'mail' => 'jdoe@email.com', + 'cn' => '', + 'mail' => 'jdoe@email.com', 'samaccountname' => 'jdoe', ]); @@ -229,8 +229,8 @@ public function test_config_password_sync_disabled() $this->app['config']->set('adldap_auth.password_sync', false); $user = $this->getMockUser([ - 'cn' => '', - 'mail' => 'jdoe@email.com', + 'cn' => '', + 'mail' => 'jdoe@email.com', 'samaccountname' => 'jdoe', ]); @@ -258,7 +258,7 @@ public function test_config_password_sync_disabled() $this->assertTrue(Auth::attempt(compact('email', 'password'))); $user = Auth::user(); - + // This check will fail due to password synchronization being disabled. $this->assertFalse(Hash::check($password, $user->password)); }