Yii2 cookie login

I was wondering if anyone could explain how cookie login works in Yii2. I see the method loginByCookiein yii \ web \ user, but I'm confused by which file and method actually call it to log in the user? Thanks in advance!

+4
source share
1 answer

You do not call a loginByCookiefunction, it is automatically called for you. First, you log in by calling \Yii::$app->login()with an identifier, but it is User::$enableAutoLoginturned on. Duration is used to determine TTL cookies. The structure supports cookies.

As an example, just check out the LoginForm-class in the main application.

+3
source

Source: https://habr.com/ru/post/1539836/


All Articles