Commit 8066a595 authored by Taylor Otwell's avatar Taylor Otwell

added remember_me cookie config option.

parent ac277c58
...@@ -63,6 +63,19 @@ return array( ...@@ -63,6 +63,19 @@ return array(
| |
*/ */
'logout' => function($user) {} 'logout' => function($user) {},
/*
|--------------------------------------------------------------------------
| "Remember Me" Cookie Name
|--------------------------------------------------------------------------
|
| Here you may specify the cookie name that will be used for the cookie
| that serves as the "remember me" token. Of course, a sensible default
| has been set for you, so you probably don't need to change it.
|
*/
'cookie' => 'laravel_remember',
); );
\ No newline at end of file
...@@ -16,13 +16,6 @@ class Auth { ...@@ -16,13 +16,6 @@ class Auth {
*/ */
const user_key = 'laravel_user_id'; const user_key = 'laravel_user_id';
/**
* The key used when setting the "remember me" cookie.
*
* @var string
*/
const remember_key = 'laravel_remember';
/** /**
* Determine if the user of the application is not logged in. * Determine if the user of the application is not logged in.
* *
...@@ -76,7 +69,7 @@ class Auth { ...@@ -76,7 +69,7 @@ class Auth {
// exists, we'll attempt to recall the user based on the cookie value. // exists, we'll attempt to recall the user based on the cookie value.
// Since all cookies contain a fingerprint hash verifying that they // Since all cookies contain a fingerprint hash verifying that they
// haven't changed, we can trust it. // haven't changed, we can trust it.
$recaller = Cookie::get(Auth::remember_key); $recaller = Cookie::get($config['cookie']);
if (is_null(static::$user) and ! is_null($recaller)) if (is_null(static::$user) and ! is_null($recaller))
{ {
...@@ -196,7 +189,9 @@ class Auth { ...@@ -196,7 +189,9 @@ class Auth {
extract($config, EXTR_SKIP); extract($config, EXTR_SKIP);
Cookie::forever(Auth::remember_key, $recaller, $path, $domain, $secure); $cookie = Config::get('auth.cookie');
Cookie::forever($cookie, $recaller, $path, $domain, $secure);
} }
/** /**
...@@ -220,7 +215,9 @@ class Auth { ...@@ -220,7 +215,9 @@ class Auth {
// When forgetting the cookie, we need to also pass in the path and // When forgetting the cookie, we need to also pass in the path and
// domain that would have been used when the cookie was originally // domain that would have been used when the cookie was originally
// set by the framework, otherwise it will not be deleted. // set by the framework, otherwise it will not be deleted.
Cookie::forget(Auth::remember_key, $path, $domain, $secure); $cookie = Config::get('auth.cookie');
Cookie::forget($cookie, $path, $domain, $secure);
Session::forget(Auth::user_key); Session::forget(Auth::user_key);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment