Log in and cookie

Hi!!!!

how the application will know that the user is logged in (authenticated). In the examples of guide 2.0 of yii 2.0 I don’t see any code that is written to let the application know that the user as been logged in (especially for checking access).

I would like to use the system of remember me(cookie)so is there any way to proced using yii framework methods?

Class yii\web\User

Also check the "Security" section of the guide:

Authentication

Authorization

I have checked the security module in the guide.

In my application the class that represent users is not called "user" is there any problem with that? and for the component to know that now the user is connected I think there must be a method or function or event that is executed, I would like to know which one is it?

No, there’s no problem with that. yii\web\User is not your user model.

For the component to know that now the user is connected I think there must be a method or function or event that is executed, I would like to know which one is it?

User model or whatever you call it should implement IdentityInterface.

The login itself happens like that:




Yii::$app->user->login($userModel);




Yii::$app->user->isGuest

to know if user is logged in.

From this I understand now, so All I need is my user model to implement IdentityInterface, Thanks