Support the ongoing development of Laravel.io →
Authentication

I'm using Larave 4.2, and everything works just fine. If I enter the correct credentials I will be taken to the correct URL (the one with auth filter). But the problem I'm currently experiencing is when one of the fields entered is incorrect and the user submits it will show a white screen.

I've checked the filters, and quite sure it is still what came with Laravel and didn't change anything.

My routes file

https://gist.github.com/lozadaOmr/7621d309bdd08374381d

This is my User model

https://gist.github.com/lozadaOmr/b9b67c10e0874f1029b0

The controller used

https://gist.github.com/lozadaOmr/968ded3d0ae87b0231b8

Last updated 3 years ago.
0

Your controller login method has no branch for failed authentication. At the end of userLogin add another Redirect::back() or other logic

0

Some notes in the code block below...

 /**
* Accepts the post request for login
* of user in CMS
*
*/
public function userLogin()
{
...

// returns validation object if fails, nothing if passes

// the single = looks off, but I normally don't make if's with var assignments in it

if ($errors = User::loginIsInvalid($user_credentials))
{
return Redirect::route('cms.login')->withInput()->withErrors($errors);
}

// if this passes then redirect to route('cms.home')

if (Auth::attempt(array(
'email' => $user_credentials['email'],
'password' => $user_credentials['password']), $remember_me))
{
return Redirect::route('cms.home');
}

// ??? what happens if auth fails it returns nothing, aka the white screen

} 

Hope that helps

0

Sign in to participate in this thread!

Eventy

Your banner here too?

lozadaOmr lozadaomr Joined 11 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.