public function renderButtons() { foreach ($this->sns as $sns) { switch ($sns) { case SnsLoginGlobal::CONFIG_SNS_FACEBOOK: $this->settings[$sns] = FacebookProperties::getInstance(); break; case SnsLoginGlobal::CONFIG_SNS_GOOGLE: $this->settings[$sns] = GoogleProperties::getInstance(); break; case SnsLoginGlobal::CONFIG_SNS_TWITTER: $this->settings[$sns] = TwitterProperties::getInstance(); break; } } $widgetHtml = $this->render($this->template, ['settings' => $this->settings]); return Html::tag('div', $widgetHtml, $this->options); }
public function actionAuthorise($code, $state) { $fbProperties = FacebookProperties::getInstance(); // Get Token $accessToken = $fbProperties->getAccessToken($code, $state); $snsUser = $fbProperties->getUser($accessToken); if (isset($snsUser)) { // Get User $user = FacebookProfileService::getUser($snsUser, $accessToken); if ($user) { // Login and Redirect to home page $login = new FacebookLogin($user); if ($login->login()) { $this->checkHome(); } } else { $this->redirect(['user-info']); } } // Model not found throw new NotFoundHttpException(Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_NOT_FOUND)); }