當我使用laravel 5 Auth
如何禁用remeber_token當用戶關閉瀏覽在laravel 5
if (Auth::attempt($auth,true)) {
// Check pass...
}
登錄,數據庫將保持remeber_token,直到我做 Auth::logout()
,
1。如何在關閉瀏覽時清除remeber_token?
2.如何設置remeber_token的存活時間?
謝謝。
當我使用laravel 5 Auth
如何禁用remeber_token當用戶關閉瀏覽在laravel 5
if (Auth::attempt($auth,true)) {
// Check pass...
}
登錄,數據庫將保持remeber_token,直到我做 Auth::logout()
,
1。如何在關閉瀏覽時清除remeber_token?
2.如何設置remeber_token的存活時間?
謝謝。
martinstoeckli說:
這將是很好,如果驗證門面將提供一個屬性來啓用/禁用記得令牌。如果一個網站不打算使用這個功能,那麼無論如何都不需要所有的東西。我發現記得functionallity相對容易規避,無法看到任何安全問題,只要你不提供設置記得在您的應用程序令牌:
class User extends BaseModel implements UserInterface, RemindableInterface
{
...
public function getRememberToken()
{
return null; // not supported
}
public function setRememberToken($value)
{
// not supported
}
public function getRememberTokenName()
{
return null; // not supported
}
/**
* Overrides the method to ignore the remember token.
*/
public function setAttribute($key, $value)
{
$isRememberTokenAttribute = $key == $this->getRememberTokenName();
if (!$isRememberTokenAttribute)
{
parent::setAttribute($key, $value);
}
}
...
您可以參考以下鏈接http://laravel.io/forum/05-21-2014-how-to-disable-remember-token
瀏覽器關閉時無法執行任何操作,因爲執行某些操作時必須執行一些PHP腳本。換句話說,你不能做什麼,直到你打電話給你的網站上的一些網址。
您是否試圖在config/session.php
中將expire_on_close
設置爲true?
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => 120,
'expire_on_close' => true,
http://stackoverflow.com/questions/25183992/why-am-i-always-logged-in-even-after-closing-browser-with-remember-me-set-to-fal –