mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 09:41:49 +08:00
Cookies: Set expires flag for remember cookies
Without this, session remembering would not work in Internet Explorer (and Edge?). Fixes #1127.
This commit is contained in:
parent
231d018de5
commit
2f714a01ed
|
@ -45,8 +45,17 @@ class CookieFactory
|
||||||
// Parse the forum's base URL so that we can determine the optimal cookie settings
|
// Parse the forum's base URL so that we can determine the optimal cookie settings
|
||||||
$url = parse_url(rtrim($this->app->url(), '/'));
|
$url = parse_url(rtrim($this->app->url(), '/'));
|
||||||
|
|
||||||
return SetCookie::create($name, $value)
|
$cookie = SetCookie::create($name, $value);
|
||||||
|
|
||||||
|
// Make sure we send both the MaxAge and Expires parameters (the former
|
||||||
|
// is not supported by all browser versions)
|
||||||
|
if ($maxAge) {
|
||||||
|
$cookie = $cookie
|
||||||
->withMaxAge($maxAge)
|
->withMaxAge($maxAge)
|
||||||
|
->withExpires(time() + $maxAge);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cookie
|
||||||
->withPath(array_get($url, 'path') ?: '/')
|
->withPath(array_get($url, 'path') ?: '/')
|
||||||
->withSecure(array_get($url, 'scheme') === 'https')
|
->withSecure(array_get($url, 'scheme') === 'https')
|
||||||
->withHttpOnly(true);
|
->withHttpOnly(true);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user