From 6621969e6251827785d2ab30354d2d54eb7818ec Mon Sep 17 00:00:00 2001 From: Agung Sugiarto Date: Wed, 13 Mar 2024 21:18:51 +0700 Subject: [PATCH] Fix config cookie codeigniter4 --- src/Adapters/SessionAdapter.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Adapters/SessionAdapter.php b/src/Adapters/SessionAdapter.php index d0635e9..eefe623 100644 --- a/src/Adapters/SessionAdapter.php +++ b/src/Adapters/SessionAdapter.php @@ -350,18 +350,19 @@ public function user() */ protected function recallerCookie(AuthenticatorInterface $user) { - $app = config('App'); + /** @var \Config\Cookie $cookie */ + $cookie = config('Cookie'); // If using login with remember, make sure to send cookie with redirect()->withCookies() $this->response->setCookie( $this->getCookieName(), $this->encrypter()->encrypt($user->getAuthId() . '|' . $user->getRememberToken() . '|' . $user->getAuthPassword()), 1 * MONTH, - $app->cookieDomain, - $app->cookiePath, - $app->cookiePrefix, - $app->cookieSecure, - $app->cookieHTTPOnly + $cookie->domain, + $cookie->path, + $cookie->prefix, + $cookie->secure, + $cookie->httponly ); } @@ -483,16 +484,17 @@ protected function cycleRememberToken(AuthenticatorInterface $user) */ protected function clearUserDataFromStorage() { - $app = config('App'); + /** @var \Config\Cookie $cookie */ + $cookie = config('Cookie'); $this->session->remove($this->getSessionName()); if (! is_null($this->recaller())) { // If using login with remember, make sure to send cookie with redirect()->withCookies() $this->response->deleteCookie( $this->getCookieName(), - $app->cookieDomain, - $app->cookiePath, - $app->cookiePrefix + $cookie->domain, + $cookie->path, + $cookie->prefix ); } }