Skip to content

Commit

Permalink
Tweak multiple authentication connection docs
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebauman committed Feb 10, 2016
1 parent 9c13d5f commit 218abca
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,16 +408,22 @@ To enable it, simply set the option to true in your `adldap_auth.php` configurat
To swap connections on the fly, set your configurations default connection and try re-authenticating the user:

```php
$auth = false;

if (Auth::attempt($credentials)) {
// Logged in successfully
$auth = true; // Logged in successfully
} else {
// Login failed, swap and try other connection.
Config::set('adldap_auth.connection', 'other-connection');

if (Auth::attempt($credentials)) {
// Passed logging in with other connection.
$auth = true; // Passed logging in with other connection.
}
}

if ($auth === true) {
return $this->handleUserWasAuthenticated($request, $throttles);
}

return 'Login incorrect!';
```

0 comments on commit 218abca

Please sign in to comment.