ollieread / multiauth

Laravel multi auth
441 stars 109 forks source link

Remember me not working #105

Closed krishspiral closed 8 years ago

krishspiral commented 8 years ago

Hi,

I'm using laravel 4.2 with Ollieread/multiauth . Authentication is working fine but remember me functionality is not working . Remember cookie is setting as remember_user_xxxx . But the user session is not persisting after 5 min. In session.php lifetime is set as 5( 'lifetime' => 5,). My auth.php is configures is as follows. 'multi' => array( 'user' => array( 'driver' => 'eloquent', 'model' => 'Customer' ), 'admin' => array( 'driver' => 'eloquent', 'model' => 'AdminUser' ) ),

ollieread commented 8 years ago

I'm pretty sure that the session expiring counts as them logging out, though that being said, there's no real reason that the remember_me shouldn't work. Which version are you using?

krishspiral commented 8 years ago

laravel 4.2 . ollieread/multiauth v3.3.1 And auth attempt is

 $remember = (Input::has('remember')) ? true : false;
  if (Auth::user()->attempt($userCredentials,$remember))
 {
 } 

Is there any other settings for remember me ?.My customer-model is as follows.

 <?php

 use Illuminate\Auth\UserTrait;
 use Illuminate\Auth\UserInterface;
 use Illuminate\Auth\Reminders\RemindableTrait;
 use Illuminate\Auth\Reminders\RemindableInterface;

 class Customer extends Eloquent implements UserInterface, RemindableInterface {

     use UserTrait, RemindableTrait;

     protected $table = 'customer';
     protected $primaryKey = 'customer_id';

     protected $hidden = array('password', 'remember_token');

     public function getAuthIdentifier() {
         return $this->getKey();
     }

     public function getAuthPassword() {
         return $this->password;
     }

     public function getReminderEmail() {
         return $this->email;
     }

     public function getRememberToken() 
        {
            return $this->remember_token;
        }

     public function setRememberToken($value) 
         {
             $this->remember_token = $value;
         }

     public function getRememberTokenName() 
         {
             return 'remember_token';
         }

 }
ollieread commented 8 years ago

I'm confident that this isn't a bug with the package, but rather, a bug with your code somewhere else down the line.