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

Commit 2a17981

Browse files
authored
Catch exception and trigger fallback
When having connection or network failures, the fallback was not executed and the user was unable to login on the application even though the fallback option was enabled.
1 parent 03dc1eb commit 2a17981

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)