SleepWalker / hoauth

yii-hoauth provides simple integration with social network authorisation lib Hybridauth in Yii.
Other
59 stars 35 forks source link

Incorrect association of the authenticated provider with the logged-in user #56

Closed imranomar closed 9 years ago

imranomar commented 9 years ago

Dear All

The issue is that if the user has already logged in and tried to log in again, then the associated record's user_id in the user_aouth table is set to 0. I guess the user_id is int and the code is trying to put the email address in Yii::app()->user->id there. Then again the Yii::app()->user->id should not have been an email address in the first place.

protected function getAccessCode() { $oAuth = $this->oAuth; // If we already have a user logged in, associate the authenticated // provider with the logged-in user if(!Yii::app()->user->isGuest) { $accessCode = 1; $oAuth->bindTo(Yii::app()->user->id); } else {

SleepWalker commented 9 years ago

Hello, imranomar

Yii::app()->user->id - this is id (primary key) Yii::app()->user->email - this is email (CWebUser has no such property, therefore you should implement this by yourself)