1

我試圖在不記得他的情況下記錄用戶(Sentry :: authenticate($ input,false);),我得到一個創建的cookie,所以我沒有得到退出瀏覽器時斷開連接。 請在下面找到Laravel 4.2:Sentry 2記住我的功能不起作用

控制器

public function store() 
{ 
    $this->loginForm->validate($input = Input::only('email', 'password')); 

    try 
    { 
     if(Input::get('remember')) { 
      Sentry::authenticateAndRemember($input); 
     } else {  
      Sentry::authenticate($input, false); 
     } 

    } 

    catch (\Cartalyst\Sentry\Users\UserNotFoundException $e) 
    { 
     return Redirect::back()->withInput()->withErrorMessage('Invalid credentials provided'); 
    } 
    catch (\Cartalyst\Sentry\Users\UserNotActivatedException $e) 
    { 
     return Redirect::back()->withInput()->withErrorMessage('User Not Activated.'); 
    } 
} 

查看

<div class="checkbox"> 
    <!-- Remember me field --> 
     <div class="form-group"> 
      {{ Form::label('remember_label', 'Remember Me? ')}} 
      <input type="checkbox" name="remember"> 
     </div> 
</div> 

我曾嘗試this我的代碼,但結果是一樣的。

在php.ini中我已經設置的session.gc_maxlifetime = 2592000

沒有人有任何線索?

感謝您的建議。

回答

1

最後我發現了我所犯的錯誤,我在下面寫下它,以便對其他人有用。

請編輯APP-> config-> session.php文件

會話生存

'lifetime' => 120, 

'expire_on_close' => true,