Ejemplo n.º 1
0
 /**
  * Google get's the url for this handle when redirecting to login dialog.
  * It automatically calls the onResponse event.
  *
  * You don't have to redirect, the request before the auth process will be restored automatically.
  */
 public function handleResponse()
 {
     $this->google->getUser();
     // check the received parameters and save user
     $this->onResponse($this);
     if (!empty($this->session->last_request)) {
         $presenter = $this->getPresenter();
         try {
             $presenter->restoreRequest($this->session->last_request);
         } catch (Application\AbortException $e) {
             $refl = new \ReflectionProperty('Nette\\Application\\UI\\Presenter', 'response');
             $refl->setAccessible(TRUE);
             $response = $refl->getValue($presenter);
             if ($response instanceof Responses\ForwardResponse) {
                 $forwardRequest = $response->getRequest();
                 $params = $forwardRequest->getParameters();
                 unset($params['do']);
                 // remove the signal to the google component
                 $forwardRequest->setParameters($params);
             }
             $presenter->sendResponse($response);
         }
     }
     $this->presenter->redirect('this', array('state' => NULL, 'code' => NULL));
 }