From 59816d1a40a5ca5843076b2887b6f409033f1fbf Mon Sep 17 00:00:00 2001 From: Marco Date: Thu, 19 Oct 2017 02:50:24 +0200 Subject: [PATCH] Re-use 'remember me' cookie from previous major versions if available --- src/Auth.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Auth.php b/src/Auth.php index c921ca4..bc4b79a 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -102,6 +102,15 @@ final class Auth extends UserManager { private function processRememberDirective() { // if the user is not signed in yet if (!$this->isLoggedIn()) { + // if there is currently no cookie for the 'remember me' feature + if (!isset($_COOKIE[$this->rememberCookieName])) { + // if an old cookie for that feature from versions v1.x.x to v6.x.x has been found + if (isset($_COOKIE['auth_remember'])) { + // use the value from that old cookie instead + $_COOKIE[$this->rememberCookieName] = $_COOKIE['auth_remember']; + } + } + // if a remember cookie is set if (isset($_COOKIE[$this->rememberCookieName])) { // split the cookie's content into selector and token