2amigos / yii2-usuario

Highly customizable and extensible user management, authentication, and authorization Yii2 extension
https://github.com/2amigos/yii2-usuario
Other
294 stars 142 forks source link

The documentation to Social Network Events is obsolete. #309

Open ivan-cc opened 5 years ago

ivan-cc commented 5 years ago

For example, there are events described in the documentation: SocialNetworkConnectEvent::EVENT_BEFORE_CONNECT && SocialNetworkConnectEvent::EVENT_AFTER_CONNECT but they are never reached.

Registration and authorization use the same controller - security/auth, but not registartion/connect.

tonydspaniard commented 5 years ago

Thank you @ivan-cc have time fora PR?

tonydspaniard commented 5 years ago

@ivan-cc thanks for reporting. I found the issue that is happening when registration is used via social networks. The problem is that when registration is happening, is RegistrationController and not SecurityController.

The documentation is not obsolete but lacks of extra documentation referring to this point. I'll add it.

References on controllers:

tonydspaniard commented 5 years ago

@maxxer needs some insights from you too. I have been following the code and it seems we have a bug.

The SocialNetworkAuthenticateService has a line that is never reached: https://github.com/2amigos/yii2-usuario/blob/master/src/User/Service/SocialNetworkAuthenticateService.php#L81

The problem is this line: https://github.com/2amigos/yii2-usuario/blob/master/src/User/Service/SocialNetworkAuthenticateService.php#L104. It creates the user so the /user/registration/connect returned by https://github.com/2amigos/yii2-usuario/blob/master/src/User/Service/SocialNetworkAuthenticateService.php#L81 is never reached, thus, never firing the events as @ivan-cc stated

tonydspaniard commented 5 years ago

@ivan-cc mind testing from master branch? I have made some changes to the SocialNetworkAuthenticateService that I believe solves the bug.

ivan-cc commented 5 years ago

I will try to test within the next days.

tonydspaniard commented 5 years ago

Let me know @ivan-cc Thanks