Skip to content

Commit

Permalink
catch model exceptions when looking up user from remember me cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared King committed May 13, 2018
1 parent c9af55d commit 6c521e9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Libs/RememberMeCookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Infuse\Auth\Models\PersistentSession;
use Infuse\Request;
use Infuse\Utility as U;
use Pulsar\Exception\ModelException;

class RememberMeCookie
{
Expand Down Expand Up @@ -199,9 +200,14 @@ public function verify(Request $req, AuthManager $auth)
}

// look up the user with a matching email address
$userClass = $auth->getUserClass();
$user = $userClass::where('email', $this->email)
->first();
try {
$userClass = $auth->getUserClass();
$user = $userClass::where('email', $this->email)
->first();
} catch (ModelException $e) {
// fail open when unable to look up the user
return false;
}

if (!$user) {
return false;
Expand Down

0 comments on commit 6c521e9

Please sign in to comment.