vendredi 5 octobre 2018

Laravel session not setting after logging in from a session timeout

We're currently developing with Laravel but we are having issues when a user was logged out because of session timeout. What we did for debugging was:

  1. Set the session timeout to one minute.
  2. Simply login. (everything was fine)
  3. Waited for a minute before the session expires.
  4. After the session expires, the system logged out.
  5. Upon logging in again, the session wasn't set and returns no value.

Here's how we add the session at LoginController.php:

$hotelier = Hotelier::where('user_id',auth()->user()->id)->first();
$company = Company::find($hotelier->company_id);

Session::put('company_id', $hotelier->company_id);
Session::put('company_api_key', $company->api_key);

Here's our code upon logout at AuthenticateUsers.php

public function logout(Request $request) {
    $this->guard()->logout();
    $request->session()->invalidate();
    return redirect('/');
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire