Khalid Al-Mutawa
Khalid Al-Mutawa

Reputation: 869

Yii2 - User Identity Secure?

Is there any way a user can force switch his Yii::$app->user->identity without logging into another account?

During development I was logged in as user id #1. I made some design changes to the view then hit refresh then I was suddenly logged in as user id #3 (which I don't have the access details for)

I relogged and tried replicating the issue but it never happened again

Upvotes: 0

Views: 274

Answers (2)

Eduardo
Eduardo

Reputation: 1831

Maybe you opened another session in other tab or window. Probably that was the issue. It never happened to me. If you want to force it you can use:

http://www.yiiframework.com/doc-2.0/yii-web-user.html#switchIdentity()-detail

I have never use it personally, but it is available.

Upvotes: 0

ScaisEdge
ScaisEdge

Reputation: 133380

There is a method in Yii\web\User setIdentity

Upvotes: 1

Related Questions