/** * @Route("/login", name="account_login") * @Method("GET") */ public function loginAction() { $securityContext = $this->container->get('security.context'); if ($securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')) { return new RedirectResponse($this->container->get('router')->generate('account_index')); } $request = $this->container->get('request'); $session = $request->getSession(); // get the login error if there is one if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) { $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR); } else { $error = $session->get(SecurityContext::AUTHENTICATION_ERROR); $session->remove(SecurityContext::AUTHENTICATION_ERROR); } if (in_array($this->get('kernel')->getEnvironment(), array('mobile', 'mobile_dev'))) { $customer = new AccountData(); $customer->setLocale($this->getRequest()->getLocale()); $newAccountData = new NewAccountData(); $newAccountData->setCustomer($customer); $newAccountForm = $this->container->get('form.factory')->create(new NewAccountType(), $newAccountData); return $this->render('MobileBundle::login.html.twig', array('last_username' => $session->get(SecurityContext::LAST_USERNAME), 'error' => $error, 'newAccountForm' => $newAccountForm->createView())); } return $this->render('SehBundle::login.html.twig', array('last_username' => $session->get(SecurityContext::LAST_USERNAME), 'error' => $error)); }
/** * @return int|null */ public function getAccentCard() { if ($this->authMode == self::BOOKING_AUTH_MOD_NEW_ACCOUNT) { return $this->newAccountData->getAccentcard(); } elseif ($this->authMode == self::BOOKING_AUTH_MOD_LOGGED_OFF) { return $this->noAccountData->getAccentcard(); } return null; }
/** * @Route("/account/create", name="account_create", options={"expose"=true}) * @Method("GET") */ public function createAction() { $customer = new AccountData(); $customer->setLocale($this->getRequest()->getLocale()); if ($facebookSession = $this->getRequest()->getSession()->get('facebook.session')) { if (isset($facebookSession['first_name']) && $facebookSession['first_name']) { $customer->setFirstName($facebookSession['first_name']); } if (isset($facebookSession['last_name']) && $facebookSession['last_name']) { $customer->setLastName($facebookSession['last_name']); } if (isset($facebookSession['email']) && $facebookSession['email']) { $customer->setEmail($facebookSession['email']); } } $newAccountData = new NewAccountData(); $newAccountData->setCustomer($customer); $newAccountForm = $this->container->get('form.factory')->create(new NewAccountType(), $newAccountData); $parameters = array('newAccountForm' => $newAccountForm->createView(), 'bundle' => in_array($this->get('kernel')->getEnvironment(), array('mobile', 'mobile_dev')) ? 'MobileBundle' : 'SehBundle'); return $this->render('SehBundle:account:create/base.html.twig', $parameters); }
/** * @Route("/set-customer", name="booking_set_customer", schemes={"https"}) */ public function setCustomer() { $bookingManager = $this->getBookingManager(); $bookingUserSelection = $this->getCurrentBooking(); $securityContext = $this->container->get('security.context'); if ($securityContext->isGranted('IS_AUTHENTICATED_FULLY') or $securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')) { $accountData = new AccountData(); $accountData->fromUser($this->getUser()); $bookingUserSelection->setExistingAccountData($accountData); } else { $bookingUserSelection->setExistingAccountData(new AccountData()); } $bookingManager->saveBookingToSession($bookingUserSelection); return new JsonResponse(true); }