Hi there, I currently have a very strange auth problem. My code is as follows:
public function loginGuest()
{
if (Auth::attempt(['username' => Input::get('username'), 'password' => Input::get('password')]));
{
Log::info('Logged user: ' . Auth::user()->username);
return Redirect::to('/');
}
return View::make('guest');
}
So the problem is that Auth::attempt is passing even if the credentials are wrong! Strangely no user is actually logged in, so the code then goes on to fail on the Log::info() line where I try and get the username.
Any ideas its very weird? I should note that I am using Homestead too.
Did you add all the filters also try calling logout then having another try
Hi thanks for your reply. Yes I have tried placing Auth::logout() just before that code to see fi it helps but no luck. I am not using any filters at this point, just trying to get the log in to work. Temporally I have created my own auth attempt function manually and that works fine, but I would prefer to use the proper one and it bugs me there is an underlying problem here.
Found the problem!! I had accidentally put a ; after the () in my if statement!!!! How did I miss that! Hours wasted lol!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community