public function authenticate(ClientInterface $client) { $attributes = $client->getUserAttributes(); $provider = $client->getId(); $clientId = $attributes['id']; $model = SocialAccount::find()->where(['provider' => $provider, 'client_id' => $clientId])->one(); if ($model === NULL) { $model->save(FALSE); } if (NULL === ($user = $model->getUser())) { $this->action->successUrl = Url::to(['/user/registration/connect', 'account_id' => $model->id]); } else { Yii::$app->user->login($user, UserModule::$rememberMeDuration); } }
public function down() { $this->dropTable(SocialAccount::tableName()); }