Example #1
0
 /**
  * Return the resolved association form.
  *
  * @param Request $request       The client Request object being processed.
  * @param bool    $includeParent Should the template be rendered in a parent, or empty container.
  *
  * @return ResolvedFormBuild
  */
 public function getFormAssociate(Request $request, $includeParent = true)
 {
     $resolvedBuild = new ResolvedFormBuild();
     /** @var Builder\Logout $builder */
     $builder = $this->formGenerator->getFormBuilder(MembersForms::FORM_ASSOCIATE, $this->session->getAuthorisation()->getGuid());
     $formAssociate = $builder->setAction(sprintf('/%s/login', $this->config->getUrlAuthenticate()))->createForm([])->handleRequest($request);
     $resolvedBuild->addBuild(MembersForms::FORM_ASSOCIATE, $builder, $formAssociate);
     $extraContext = ['twigparent' => $includeParent ? $this->config->getTemplate('authentication', 'parent') : '@Members/authentication/_sub/login.twig'];
     $resolvedBuild->setContext($extraContext);
     return $resolvedBuild;
 }
Example #2
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');
 }
Example #3
0
 /**
  * Create a new provider entity object.
  *
  * @param AccessToken            $accessToken
  * @param ResourceOwnerInterface $resourceOwner
  */
 protected function createProviderTransition(AccessToken $accessToken, ResourceOwnerInterface $resourceOwner)
 {
     // Create a new provider entry
     $providerName = $this->providerManager->getProviderName();
     // If we have an authorisation, this is for an existing and logged in account,
     // else we either have a new registration or one we need to find an associate.
     $guid = $this->session->getAuthorisation()->getGuid();
     $transition = new Transition($guid, $providerName, $accessToken, $resourceOwner);
     $this->session->addAccessToken($providerName, $accessToken)->setTransitionalProvider($transition);
     $this->setDebugMessage(sprintf('Creating provider profile for %s ID %s', $providerName, $resourceOwner->getId()));
     $this->setDebugMessage(sprintf('Creating provisional %s provider entity for access token %s for ID %s', $providerName, $accessToken, $resourceOwner->getId()));
 }