Laravel login does not work in browser and Internet Explorer

Logging in with Laravel 5 does not work with Edge and Internet Explorer, works fine in other browsers.

We suspect this is due to the fact that the sessions are not properly stored, but honestly, we do not know what causes this problem.

When we log into the system with the correct data, the logon logic starts and ends properly, but after that it is simply redirected back to the login page, so it is likely that the middleware considers that the user is not logged in and returns them to the login page, so we think this is related to the sessions.

This is our login script:

$rules = array('email' => 'required|email|min:3|max:60', 'password' => 'required|min:6|max:20'); $attributeNames = array( 'email' => strtolower(Lang::get('auth.email')), 'password' => strtolower(Lang::get('auth.password')), ); $validator = Validator::make(Input::all(), $rules); $validator->setAttributeNames($attributeNames); if ($validator->fails()){ return Redirect::back()->withErrors($validator); die(); } //Make an login attempt $auth = Auth::attempt(array( 'email' => Input::get('email'), 'password' => Input::get('password'), 'role' => 'admin' ), false); if(!$auth){ $auth2 = Auth::attempt(array( 'email' => Input::get('email'), 'password' => Input::get('password'), 'role' => 'user' ), false); if(!$auth2){ return Redirect::back()->withErrors(Lang::get('auth.errorText'))->withInput(Input::all()); die(); } } //If user is not activated if(Auth::User()->activated != 'OK'){ Auth::logout(); return Redirect::back()->withErrors(Lang::get('auth.notActivated')); die(); } if(Auth::User()->sms_verificatie == '1') { $user = Auth::User(); $user->sms_ok = 0; $user->save(); $sms_codes_verwijderen = UsersSMSLogin::where('id_cms_users','=',Auth::User()->id)->delete(); return Redirect::route('sms-verificatie'); die(); } Session::forget('dashboard_werkgever'); return Redirect::route('dashboard'); 
+7
internet-explorer microsoft-edge php login laravel-5
source share
3 answers

Changing the cookie name to delete _ (underscore) worked for me.

In app/config/session.php changed

'cookie' => 'laravel_session'

to

'cookie' => 'laravelsession'

+3
source share

The problem seems to be related to Google Analytics, we removed the Analytics script in Edge and Internet exploder, and now everything works fine ...

+1
source share

Just in case, this helps everyone, I recently had a very similar problem. It turns out I had two web applications in the same domain that used the same session cookie name, and although some browsers sent the correct cookie (by pure chance, I suppose), IE was not.

Lesson from this? Always change the default cookie name laravel_session :)

This post has proven useful ... How do I handle multiple cookies with the same name?

0
source share

All Articles