/**
  * Displays Facebook sign up modal (called by index method)
  */
 public function modal()
 {
     $fbUserId = $this->getFacebookUserId();
     if (empty($fbUserId)) {
         $this->skipRendering();
         return;
     }
     // get an email from Facebook API
     $userInfo = \FacebookClient::getInstance()->getUserInfo($fbUserId);
     // BugId:24400
     if (!$userInfo) {
         $this->skipRendering();
         return;
     }
     $returnToUrl = $this->userLoginHelper->getRedirectUrl('fbconnected=1');
     $returnTo = $this->wg->request->getVal('returnto');
     $returnToQuery = $this->wg->request->getVal('returntoquery');
     $returnToParams = 'returnto=' . $returnTo;
     if ($returnToQuery) {
         $returnToParams .= '&returntoquery=' . htmlspecialchars($returnToQuery);
     }
     $this->response->setData(['fbEmail' => $userInfo->getProperty('email'), 'returnToUrl' => $returnToUrl, 'queryString' => $returnToParams, 'loginToken' => UserLoginHelper::getSignupToken()]);
 }
Ejemplo n.º 2
0
 /**
  * @param string $page
  * @param string $queryString
  * @param string $extraQueryString
  * @param int $cbVal
  * @param Title $actualTitle
  * @param string $actualQueryString
  *
  * @dataProvider getRedirectUrlDataProvider
  */
 public function testGetRedirectUrl($page, $queryString, $extraQueryString, $cbVal, Title $actualTitle, $actualQueryString)
 {
     $request = F::app()->wg->Request;
     $request->setVal('returnto', $page);
     $request->setVal('returntoquery', $queryString);
     $userLoginHelper = new UserLoginHelper();
     $testUrl = $userLoginHelper->getRedirectUrl($extraQueryString, $cbVal);
     $actualUrl = $actualTitle->getFullUrl($actualQueryString);
     $this->assertEquals($testUrl, $actualUrl);
 }