public function actionAuthorise($code, $state) { $googleProperties = GoogleProperties::getInstance(); // Get Token $accessToken = $googleProperties->getAccessToken($code, $state); $snsUser = $googleProperties->getUser($accessToken); if (isset($snsUser)) { // Get User $user = GoogleProfileService::getUser($snsUser, $accessToken); // Login and Redirect to home page $login = new GoogleLogin($user); if ($login->login()) { $this->checkHome(); } } // Model not found throw new NotFoundHttpException(Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_NOT_FOUND)); }
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); }