Ejemplo n.º 1
0
 /**
  * Display that profile editing form.
  *
  * @param TwigEnvironment $twigEnvironment
  * @param string          $template
  *
  * @return TwigMarkup
  */
 public function renderEdit(TwigEnvironment $twigEnvironment, $template = null)
 {
     if (!$this->session->hasAuthorisation()) {
         return $this->renderLogin($twigEnvironment, $template);
     }
     $guid = $this->session->getAuthorisation()->getGuid();
     $template = $template ?: $this->config->getTemplate('profile', 'edit');
     $form = $this->formManager->getFormProfileEdit(new Request(), false, $guid);
     $html = $this->formManager->renderForms($form, $twigEnvironment, $template);
     return new TwigMarkup($html, 'UTF-8');
 }
Ejemplo n.º 2
0
 /**
  * Set up a session for an existing provider registration.
  *
  * @param string                 $providerName
  * @param AccessToken            $accessToken
  * @param ResourceOwnerInterface $resourceOwner
  */
 protected function setSessionExistingProvider($providerName, AccessToken $accessToken, ResourceOwnerInterface $resourceOwner)
 {
     if ($this->session->hasAuthorisation()) {
         // Member is already in possession of another login, and the provider exists, add the access token
         $this->session->getAuthorisation()->addAccessToken($providerName, $accessToken);
         $this->setDebugMessage(sprintf('Adding %s access token %s for ID %s', $providerName, $accessToken, $resourceOwner->getId()));
         return;
     }
     // Existing user with a new login, and the provider exists
     $this->session->addAccessToken($providerName, $accessToken)->createAuthorisation($this->getProviderEntity()->getGuid());
     $this->setDebugMessage(sprintf('Creating authorisation  for GUID %s, and %s provider access token %s for ID %s', $this->getProviderEntity()->getGuid(), $providerName, $accessToken, $resourceOwner->getId()));
 }