yii user components

yii/web/user

enableAutoLogin: If not logged in, you will log in from the cookie
autoRenewCookie:. If you are logged in, renewIdentityCookie will be used to update the cookie expire the cookie expiration time to ensure that the expiration time is the last time has been to maintain and save the cookie response's ... If time is false, expired time as they start to log in. otherwise, in terms of time of last access

init

1. component initialization time, will open the session,
2.renewAuthStatus if the user has logged in, you check authTimeout. If the timeout is out, but do not destroy the session
3.loginByCookie enableAutoLogin and if the user is a guest, the user will log in from the cookie If already logged will be updated expiration time
difference loginByCookie and login are
opened automatically log words. executes the second argument EVENT_BEFORE_LOGIN and EVENT_AFTER_LOGIN events loginByCookie trigger is true .. verifies validateAuthKey
---------- ----- commonly used functions ----------------------------
the Login
Zimbabwe Logout
checkAccess
getId
getIdentity
---------- -------------------------------------------------- -----

log in

1.session_regenerate_id (true); If set to true, the current value becomes even more session_id, and to clear the current session an array .. The default is false, when the call will change the current value of session_id and retention session array.
2. Set Identity
3. idVar in the session set
4. Set authTimeoutVar session to
5. The use of expiration time to update the cookie sendIdentityCookie

Sign out

1. If authTimeout exist, it will check whether the session in authTimeoutVar timeout, if a timeout logout delete the cookie, and Identity = null but not destroyed session;
2.logout (to true), it will destroy session

Check whether Log

getIsGuest obtain idVar from the session. If there is written Identity

Reproduced in: https: //my.oschina.net/zhepama/blog/265027

Guess you like

Origin blog.csdn.net/weixin_33736048/article/details/91927355