Exemplo n.º 1
0
 /**
  * Return the combined login & registration resolved form object.
  *
  * @param Request $request    The client Request object being processed.
  * @param string  $twigParent Parent Twig template to be used.
  *
  * @return ResolvedFormBuild
  */
 protected function getFormCombinedLogin(Request $request, $twigParent)
 {
     $resolvedBuild = new ResolvedFormBuild();
     $resolvedBuild->setContext(['twigparent' => $twigParent]);
     /** @var Builder\Associate $builder */
     $builder = $this->formGenerator->getFormBuilder(MembersForms::FORM_ASSOCIATE);
     $builder->setAction(sprintf('/%s/login', $this->config->getUrlAuthenticate()));
     $associateForm = $builder->createForm([])->handleRequest($request);
     $resolvedBuild->addBuild(MembersForms::FORM_ASSOCIATE, $builder, $associateForm);
     /** @var Builder\LoginOauth $builder */
     $builder = $this->formGenerator->getFormBuilder(MembersForms::FORM_LOGIN_OAUTH);
     $builder->setAction(sprintf('/%s/login', $this->config->getUrlAuthenticate()));
     $formOauth = $builder->createForm([])->handleRequest($request);
     $resolvedBuild->addBuild(MembersForms::FORM_LOGIN_OAUTH, $builder, $formOauth);
     /** @var Builder\LoginPassword $builder */
     $builder = $this->formGenerator->getFormBuilder(MembersForms::FORM_LOGIN_PASSWORD);
     $builder->setAction(sprintf('/%s/login', $this->config->getUrlAuthenticate()));
     $formPassword = $builder->createForm([])->handleRequest($request);
     $resolvedBuild->addBuild(MembersForms::FORM_LOGIN_PASSWORD, $builder, $formPassword);
     /** @var Builder\ProfileRegister $builder */
     $builder = $this->formGenerator->getFormBuilder(MembersForms::FORM_PROFILE_REGISTER);
     $builder->setAction(sprintf('/%s/profile/register', $this->config->getUrlMembers()));
     $formRegister = $builder->createForm([])->handleRequest($request);
     if ($this->session->isTransitional()) {
     }
     $resolvedBuild->addBuild(MembersForms::FORM_PROFILE_REGISTER, $builder, $formRegister);
     return $resolvedBuild;
 }
Exemplo n.º 2
0
 /**
  * Display the registration form.
  *
  * @param TwigEnvironment $twigEnvironment
  * @param string          $template
  *
  * @return TwigMarkup
  */
 public function renderRegister(TwigEnvironment $twigEnvironment, $template = null)
 {
     $context = ['transitional' => $this->session->isTransitional()];
     $template = $template ?: $this->config->getTemplate('profile', 'register');
     $form = $this->formManager->getFormProfileRegister(new Request(), false);
     $html = $this->formManager->renderForms($form, $twigEnvironment, $template, $context);
     return new TwigMarkup($html, 'UTF-8');
 }
Exemplo n.º 3
0
 /**
  * Create a 'remote' provider record from a session stored 'transitional' one.
  *
  * @param string $guid
  *
  * @return Storage\Entity\Provider
  */
 protected function convertTransitionalProviderToEntity($guid)
 {
     $provider = $this->session->getTransitionalProvider()->getProviderEntity();
     $provider->setGuid($guid);
     $provider->setLastupdate(Carbon::now());
     $this->records->saveProvider($provider);
     $this->session->removeTransitionalProvider();
     return $provider;
 }
Exemplo n.º 4
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()));
 }