Conversation
I think we need abstract the credentials storage. |
I updated my code, although I have a doubt with authKey. Whether it is necessary or not. |
As for the questions:
|
|
|
@samdark ok, great. Can you guide me a little please?.
Thanks! |
|
@samdark I updated my PR, but I have some questions.
The rest is OK? Thanks! |
|
$guestAfterHandle = $this->user->isGuest(); | ||
|
||
if ($guestBeforeHandle && !$guestAfterHandle) { | ||
$this->autoLogin->addCookie($this->user->getIdentity(false), $response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Create an issue about adding two tests |
@mapeveri it's mostly finished except two tests that I have no idea on how to implement in a good way. What do you think? |
Thanks for starting it, @mapeveri. |
@samdark thanks to you. I would like make a some questions, for understand, because I have some doubts. The if of the line https://github.com/mapeveri/yii-web/blob/e89d374cf0b9d2dc838ac449f46e9dde510d963a/src/User/AutoLoginMiddleware.php#L43 I don't understands this. It is not clear to me when each condition is met to add the cookie or not. The login is done on this line: https://github.com/mapeveri/yii-web/blob/e89d374cf0b9d2dc838ac449f46e9dde510d963a/src/User/AutoLoginMiddleware.php#L97 |
These conditions are to detect if user logged in (was guest, became non-guest) or logged out (was non-guest, became guest) in the current request. On login we're setting a cookie. On logout we're removing a cookie. This is totally separated from logging user in by existing cookie that it happening regardless in the very beginning. |
@samdark thanks!! |
This PR is incomplete, I have some questions:
I think I do not forget anything else, I wait for suggestions and improvements :)