public function switchLocaleAction(Request $request) { $this->guard->userIsLoggedIn(); $this->logger->notice('User requested to switch locale'); $returnUrl = $request->query->get('return-url'); // Return URLs generated by us always include a path (ie. at least a forward slash) // @see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Request.php#L878 $domain = $request->getSchemeAndHttpHost() . '/'; if (strpos($returnUrl, $domain) !== 0) { $this->logger->error(sprintf('Illegal return-url ("%s") for redirection after changing locale, aborting request', $returnUrl)); throw new BadRequestHttpException('Invalid return-url given'); } $command = new ChangeLocaleCommand(); $form = $this->formFactory->create('profile_switch_locale', $command, [])->handleRequest($request); $this->logger->notice(sprintf('Switching locale from "%s" to "%s"', $request->getLocale(), $command->newLocale)); if ($form->isValid()) { $this->userService->changeLocale($command); $this->flashBag->add('success', 'profile.locale.locale_change_success'); $this->logger->notice(sprintf('Successfully switched locale from "%s" to "%s"', $request->getLocale(), $command->newLocale)); } else { $this->flashBag->add('error', 'profile.locale.locale_change_fail'); $this->logger->error('Locale not switched: the switch locale form contained invalid data'); } return new RedirectResponse($returnUrl); }
/** * @return Response */ public function overviewAction() { $this->guard->userIsLoggedIn(); $this->logger->notice('Showing My Profile page'); $user = $this->userService->getUser(); return new Response($this->templateEngine->render('OpenConextProfileBundle:MyProfile:overview.html.twig', ['user' => $user])); }
public function overviewAction() { $this->guard->userIsLoggedIn(); $this->logger->notice('User requested My Services page'); $user = $this->authenticatedUserProvider->getCurrentUser(); $specifiedConsentList = $this->specifiedConsentListService->getListFor($user); $this->logger->notice(sprintf('Showing %s services on My Services page', count($specifiedConsentList))); return new Response($this->templateEngine->render('OpenConextProfileBundle:MyServices:overview.html.twig', ['specifiedConsentList' => $specifiedConsentList])); }
/** * @return Response */ public function overviewAction() { $this->guard->userIsLoggedIn(); $this->logger->notice('Showing Introduction page'); return new Response($this->templateEngine->render('OpenConextProfileBundle:Introduction:overview.html.twig')); }
public function confirmMailSentAction() { $this->guard->userIsLoggedIn(); return new Response($this->templateEngine->render('OpenConextProfileBundle:AttributeSupport:confirmation.html.twig')); }