Welcome Guest, Not a member yet? Register   Sign In
ionauth and shopping cart
#1

[eluser]martynrlee[/eluser]
Hi all,

I am integrating ionauth with the codeigniter cart, both are working great however if I have items in my cart then I login, I lose the cart items.

Guess this is session related, I have scanned the login scripts and doesnt seem to be ended the session and starting a new one, so I am a bit lost.

Fairly new to codeigniter, so if someone could point me in the right direction that would be great.

Thanks,

Martyn
#2

[eluser]martynrlee[/eluser]
hmmm, anyone else have any advice?
#3

[eluser]basementDUDE[/eluser]
I also use shopping cart and ion auth, I lose cart info when user logout.
Have not really looking into this issue yet, may we should post this issue on the ion auth post.
#4

[eluser]WanWizard[/eluser]
This is a known issue with the way most users implement authentication.

Instead of having a proper data structure within the session to store user related information, and erasing/resetting that when a user logs out, they take the lazy option, and do a $this->session->sess_destroy(). That takes care of the logout, but also deletes all other valuable information in the session.

If you look in the Ion_auth library, in the logout() method, there a line that says
Code:
$this->ci->session->sess_destroy();

Comment this to retain your session. The unset_userdata() calls above that line will make sure the user is logged out.
#5

[eluser]martynrlee[/eluser]
Thanks WanWizard, thats really useful.

Martyn.
#6

[eluser]basementDUDE[/eluser]
what I don't understand is, the author already unset all the login data, why he still called sess_destory after that?

Code:
$identity = $this->ci->config->item('identity', 'ion_auth');
        $this->ci->session->unset_userdata($identity);
        $this->ci->session->unset_userdata('group');
        $this->ci->session->unset_userdata('id');
        $this->ci->session->unset_userdata('user_id');

[quote author="WanWizard" date="1282691783"]This is a known issue with the way most users implement authentication.

Instead of having a proper data structure within the session to store user related information, and erasing/resetting that when a user logs out, they take the lazy option, and do a $this->session->sess_destroy(). That takes care of the logout, but also deletes all other valuable information in the session.

If you look in the Ion_auth library, in the logout() method, there a line that says
Code:
$this->ci->session->sess_destroy();

Comment this to retain your session. The unset_userdata() calls above that line will make sure the user is logged out.[/quote]
#7

[eluser]WanWizard[/eluser]
Seen that as well. I guess he wanted to be absolutely sure... Smile




Theme © iAndrew 2016 - Forum software by © MyBB