Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 066715e

Browse files
authored
Merge pull request #898 from ivanwitzke/patch-1
Catch exception and trigger fallback
2 parents 03dc1eb + 2a17981 commit 066715e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Auth/DatabaseUserProvider.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Adldap\Laravel\Auth;
44

5+
use Adldap\Auth\BindException;
56
use Adldap\Laravel\Commands\Import;
67
use Adldap\Laravel\Commands\SyncPassword;
78
use Adldap\Laravel\Events\AuthenticatedWithCredentials;
@@ -90,7 +91,13 @@ public function updateRememberToken(Authenticatable $user, $token)
9091
*/
9192
public function retrieveByCredentials(array $credentials)
9293
{
93-
$user = Resolver::byCredentials($credentials);
94+
try {
95+
$user = Resolver::byCredentials($credentials);
96+
} catch (BindException $e) {
97+
if (!$this->isFallingBack()) {
98+
throw $e;
99+
}
100+
}
94101

95102
if ($user instanceof User) {
96103
return $this->setAndImportAuthenticatingUser($user);

0 commit comments

Comments
 (0)