Solid
(Jorgen1987)
1
Hi all!
Im having a issue i just found with my Authentication.
When the user logs in, i save a few sessions:
Yii::app()->session['id'] = $user->id;
Yii::app()->session['name'] = $user->name;
Yii::app()->session['email'] = $user->email;
And this works fine, the name displays at the top.
But when the browser is closed and reopend the loginstate remains true (Yii::app()->user->isGuest returns FALSE)
but the name and email is no longer stored.
Why is this? How can i slove that?
Thank you!
capsuline
(Robinkouwen)
2
Try to use state instead:
Yii::app()->user->setState('id', $user->id);
Yii::app()->user->setState('name', $user->name);
Yii::app()->user->setState('email', $user->email);
Should be available next time unless you logout.
You can retrieve your stored state as follow:
Yii::app()->user->getState('id');
Yii::app()->user->getState('name');
Yii::app()->user->getState('email');
Solid
(Jorgen1987)
3
[size=2]Thank you. That did not help, but the error was wrongful authentication.[/size]
Sorry for wasting your time
Have a good day.
MadTiago
(Madtiago)
4
[size=2]I’m having the same problem, when I use “Remember me” it keeps the session when I close the browser but my “setState”'s are not saved.[/size]
Can you share your solution? 
Please consider the default session time in the server. And rewrite according to your wish.
MadTiago
(Madtiago)
6
Thanks for your reply. Fixed it.
Changed session.cookie_lifetime on php.ini, it had 0 as default.