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($oauth_token, $oauth_verifier)
 {
     $twitterProperties = TwitterProperties::getInstance();
     $twitterProperties->setAuthToken($oauth_token, $oauth_verifier);
     $twitterProperties->getAccessToken();
     $snsUser = $twitterProperties->getUser();
     if ($snsUser) {
         // Get User
         $user = TwitterProfileService::getUser($snsUser, Yii::$app->session->get('tw_oauth_token'));
         if ($user) {
             // Login and Redirect to home page
             $login = new TwitterLogin($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));
 }