cartalyst / sentinel

A framework agnostic authentication & authorization system.
BSD 3-Clause "New" or "Revised" License
1.51k stars 238 forks source link

Sentinel::login error #542

Open arashsoltani opened 3 years ago

arashsoltani commented 3 years ago

hi.. i have an issue in creating Login with Sentinel. this code, works perfectly as the user has registered in the system. But, when it cant find the user, i get this error:

Argument 1 passed to Cartalyst\Sentinel\Sentinel::login() must implement interface Cartalyst\Sentinel\Users\UserInterface, bool given, called in C:\xampp\htdocs\portal\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 261

here is the code:

$user = Sentinel::authenticate($request->all()); if (Sentinel::check($user)){ Sentinel::login($user); return redirect('/'); } else{ return redirect()->back(); }

how should i fix this? thanks

m33ts4k0z commented 3 years ago

Change the code to this:

if($user = Sentinel::authenticate($request->only('email', 'password'))) {
 return redirect('/'); 
} else { 
return redirect()->back();
 }
arashsoltani commented 3 years ago

thanks for your help

hardcoding commented 3 years ago

@arashsoltani Is the status of this issue still correct?