Cannot override Cookie expires.
Closed this issue · 2 comments
justinatack commented
The following suggested code has no effect on overriding the cookie expiry length.
$this->Cookie->write('RememberMe', $data, true, '+1 year');
If I access the construct config and change it there it works however this is not practically in production. I have tried setting it on the $this->loadComponent('Cookie', ['expires' => '+1 year']) however this doesn't work either.
justinatack commented
protected function _setCookie() {
if (!$this->request->data('remember_me')) {
return false;
}
$this->Cookie->configKey('RememberMe', [
'expires' => '+90 days',
'httpOnly' => true
]);
$this->Cookie->write('RememberMe', [
'email' => $this->request->data('email'),
'password' => $this->request->data('password')
]);
return true;
}
justinatack commented
The above code fixes this issue.