I have looked at other people's problems similar to this, but nothing is like what I am experiencing. Please feel free to link to my article if this has been reviewed previously.
I wrote a cookie when the user authenticates, and locally stores some basic user information. When the user logs out, I try to delete the cookie variable, but it is not deleted. If I use the destroy method, the cookie is deleted, but I'm curious what I'm doing wrong here:
Cookie is written this way and it works:
function login(){ if($this->Auth->login($this->data)){ $this->Cookie->write('User.email',$this->data['User']['email'],true, '1 day'); } }
However, using the delete function does not work ...
function logout(){ $this->Cookie->delete('User'); if($this->Auth->logout($this->data)){
If I replaced delete with destroy, it will work. This does not work because the cookie data is encrypted? I'm probably doing something stupid, but I can't figure out how to figure it out.
I use this cookie to continue my sessions. I want it to be deleted if the user clicks the logout button.
Thanks!
source share