简体   繁体   中英

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

Yii \\ web \\ User setIdentity中有一个方法

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM