Skip to content

Commit

Permalink
Fix config cookie codeigniter4
Browse files Browse the repository at this point in the history
  • Loading branch information
agungsugiarto committed Mar 13, 2024
1 parent 43c2882 commit 6621969
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/Adapters/SessionAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}

Expand Down Expand Up @@ -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
);
}
}
Expand Down

0 comments on commit 6621969

Please sign in to comment.