Is there anybody that could give me a small tutorial like here: or tell me, what I have to change?
I understand that the cookie component which I am using now, is deprecated and that I should use middleware. Now I don’t know how to read and write cookies any more.
The console of the Firefox-Broser says:
Einige Cookies verwenden das empfohlene “SameSite”-Attribut inkorrekt. 2
Das Cookie “PflanzenLernen” wird in Zukunft bald abgelehnt werden, da es für das Attribut “SameSite” entweder “None” oder einen ungültigen Wert angibt, ohne das “secure”-Attribut zu verwenden. Weitere Informationen zum “SameSite”-Attribut finden Sie unter https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite.
This ist my code in the App-Controller:
public function initialize() {
parent::initialize();
$this->loadComponent('RequestHandler', ['enableBeforeRedirect' => false]);
$this->loadComponent('Flash', ['clear' => true]);
$this->loadComponent('Cookie');
$this->loadComponent('Optionen');
date_default_timezone_set('Europe/Zurich');
$this->Cookie->setConfig([
'expires' => '+31 days'
]);
$this->Cookie->configKey('PflanzenLernenUpdateModus', [
'expires' => '0'
]);
if ($this->Cookie->check ('PflanzenLernenUpdateModus')) {
$updateModus = $this->Cookie->read ('PflanzenLernenUpdateModus');
} else {
$updateModus = "aus";
$this->Cookie->write ('PflanzenLernenUpdateModus', "aus");
}
Configure::write('updateModus', $updateModus);
$this->set('updateModus',$updateModus);
Thank you very much for your help.
Dorothee