@return Response|RedirectResponse

@throws AccessDeniedException
193612
public function changePasswordAction()
    {
        $user = $this->getUser();
        if (!is_object($user) || !$user instanceof UserInterface) {
            $this->createAccessDeniedException('This user does not have access to this section.');
        }

        $this->get('session')->remove('_bruery_user.password_expire.' . $user->getId());

        $form = $this->container->get('bruery.user.change_password.form');
        $formHandler = $this->container->get('bruery.user.change_password.form.handler');

        $process = $formHandler->process($user);
        if ($process) {
            $this->setFlash('fos_user_success', 'change_password.flash.success');
            return $this->redirect($this->getRedirectionUrl($user));
        }

        $template = $this->get('bruery_core.template_loader')->getTemplates();

        return $this->render($template['bruery_user.template.change_password.form'], array('form' => $form->createView()));
    }
403529
public function changePasswordAction(Request $request)
    {
        $user = $this->getUser();
        if (!is_object($user) || !$user instanceof UserInterface) {
            throw new AccessDeniedException('This user does not have access to this section.');
        }

        /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */
        $dispatcher = $this->get('event_dispatcher');

        $event = new GetResponseUserEvent($user, $request);
        $dispatcher->dispatch(FOSUserEvents::CHANGE_PASSWORD_INITIALIZE, $event);

        if (null !== $event->getResponse()) {
            return $event->getResponse();
        }

        /** @var $formFactory \FOS\UserBundle\Form\Factory\FactoryInterface */
        $formFactory = $this->get('fos_user.change_password.form.factory');

        $form = $formFactory->createForm();
        $form->setData($user);

        $form->handleRequest($request);

        if ($form->isValid()) {
            /** @var $userManager \FOS\UserBundle\Model\UserManagerInterface */
            $userManager = $this->get('fos_user.user_manager');

            $event = new FormEvent($form, $request);
            $dispatcher->dispatch(FOSUserEvents::CHANGE_PASSWORD_SUCCESS, $event);

            $userManager->updateUser($user);

            if (null === $response = $event->getResponse()) {
                $this->get('session')->getFlashBag()->add('message', array(
                    'type' => 'success',
                    'message' => 'The record has been updated successfully.',
                ));

                return new RedirectResponse($this->generateUrl('admin_user'));
            }

            $dispatcher->dispatch(FOSUserEvents::CHANGE_PASSWORD_COMPLETED, new FilterUserResponseEvent($user, $request, $response));

            return $response;
        }

        return $this->render('FOSUserBundle:ChangePassword:changePassword.html.twig', array(
            'form' => $form->createView()
        ));
    }
251874
public function handler(): Response
    {
        $data = $this->validate([
            'name' => [],
            'slug' => [],
            'color' => [],
            'icon' => [],
        ]);
        $role = Role::find($this->getParameter('id'));
        if (!$role) {
            throw new HttpForbiddenException();
        }
        $role->update($data);
        $this->log('info', 'Update role [' . $role->getSlug() . ']');
        return response();
    }
559380
public function deleteMessageAction(Message $message)
    {
        if ($this->authorization->isGranted('moderate', new ResourceCollection(array($message->getSubject()->getCategory()->getForum()->getResourceNode())))) {
            $this->manager->deleteMessage($message);

            return new RedirectResponse(
                $this->generateUrl('claro_forum_messages', array('subject' => $message->getSubject()->getId()))
            );
        }

        throw new AccessDeniedException();
    }
1371725
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $user_id = (int) $request->getParsedBody()['user_id'];

        $user = $this->user_service->find($user_id);

        if ($user === null) {
            throw new NotFoundHttpException('User ID ' . $user_id . ' not found');
        }

        if (Auth::isAdmin($user)) {
            throw new AccessDeniedHttpException('Cannot delete an administrator');
        }

        Log::addAuthenticationLog('Deleted user: ' . $user->userName());
        $this->user_service->delete($user);

        return response('', StatusCodeInterface::STATUS_NO_CONTENT);
    }
1330954
public function redirectToRoute()
    {
        if ($this->getRequest()
                 ->isXmlHttpRequest()) {
            return [
                'redirect' => call_user_func_array(
                    [
                        $this->url(),
                        'fromRoute',
                    ],
                    func_get_args()
                ),
            ];
        }

        return call_user_func_array(
            [
                $this->redirect(),
                'toRoute',
            ],
            func_get_args()
        );
    }
63109
private void redirectToAccessDeniedView(FacesContext context, UIViewRoot viewRoot) {
        // If a user has already done a redirect and rendered the response (possibly in an observer) we cannot do this output
        final PhaseId currentPhase = context.getCurrentPhaseId();
        if (!context.getResponseComplete() && !PhaseId.RENDER_RESPONSE.equals(currentPhase)) {
            AccessDeniedView accessDeniedView = viewConfigStore.getAnnotationData(viewRoot.getViewId(), AccessDeniedView.class);
            if (accessDeniedView == null || accessDeniedView.value() == null || accessDeniedView.value().isEmpty()) {
                log.warn("No AccessDeniedView is configured, returning 401 response (access denied). Please configure an AccessDeniedView in the ViewConfig.");
                context.getExternalContext().setResponseStatus(401);
                context.responseComplete();
                return;
            }
            String accessDeniedViewId = accessDeniedView.value();
            log.debugf("Redirecting to configured AccessDenied %s", accessDeniedViewId);
            NavigationHandler navHandler = context.getApplication().getNavigationHandler();
            navHandler.handleNavigation(context, "", accessDeniedViewId);
            context.renderResponse();
        }
    }
737257
public function changePasswordAction()
    {
        $user = $this->getUser();
        if (!is_object($user) || !$user instanceof UserInterface) {
            throw new AccessDeniedException('This user does not have access to this section.');
        }
        
        $formProfile = $this->createForm(
            new ProfileFormType($this->container->getParameter('fos_user.model.user.class')),
            $user
        );
        $formPassword = $this->container->get('fos_user.change_password.form');
        
        $formHandler = $this->container->get('fos_user.change_password.form.handler');
        $process = $formHandler->process($user);
        if ($process) {
            $this->container->get('session')->getFlashBag()->set('success', $this->get('translator')->trans('change_password.flash.success', array(), 'FOSUserBundle'));
            return $this->redirect($this->generateUrl('olix_security_profile_edit'));
        }
        
        return $this->container->get('olix.admin')->render('OlixSecurityBundle:Profile:edit.html.twig', null, array(
            'user' => $user,
            'tab'  => 'password',
            'form' => array(
                'profile'  => $formProfile->createView(),
                'password' => $formPassword->createView(),
            ),
        ));
    }
816633
public function viewAction($reference)
    {
        $order = $this->getOrderManager()->findOneBy(['reference' => $reference]);

        if (null === $order) {
            throw new AccessDeniedException();
        }

        $this->checkAccess($order->getCustomer());

        $invoice = $this->getInvoiceManager()->findOneBy(['reference' => $reference]);

        if (null === $invoice) {
            $invoice = $this->getInvoiceManager()->create();

            $this->getInvoiceTransformer()->transformFromOrder($order, $invoice);
            $this->getInvoiceManager()->save($invoice);
        }

        $this->get('sonata.seo.page')->setTitle($this->get('translator')->trans('invoice_view_title', [], 'SonataInvoiceBundle'));

        return $this->render('SonataInvoiceBundle:Invoice:view.html.twig', [
            'invoice' => $invoice,
            'order' => $order,
        ]);
    }
442103
public static function accessDenied($hint = null, $redirectUri = null, Throwable $previous = null)
    {
        return new static(
            'The resource owner or authorization server denied the request.',
            9,
            'access_denied',
            401,
            $hint,
            $redirectUri,
            $previous
        );
    }
1253107
public function handler(): Response
    {
        $data = $this->validate([
            'role' => []
        ]);
        $member = Member::search($this->getParameter('username'));
        if (!$member) {
            throw new HttpNotFoundException();
        }
        $data['role'] = Role::findBy(['slug' => $data['role']]);
        if (!$data['role']) {
            throw new HttpForbiddenException();
        }
        $member->update($data);
        $this->log('info', 'Update member [' . $member->getUsername() . ']\'s role to [' . $data['role']->getSlug() . ']');
        return response();
    }
525109
public function getResponse()
    {
        $response = redirect()->to($this->getRedirectUrl());
        $response->withInput($this->request->input());
        $response->withErrors($this->getErrors(), 'default');
        $response->setCharset(config('app.charset', 'UTF-8'));

        return $response;
    }
815888
public function redirect()
    {
        $http = eZHTTPTool::instance();
        $currentSiteAccess = eZSiteAccess::current();

        if ( $http->hasGetVariable( 'notmobile' ) )
        {
            setcookie( 'eZMobileDeviceDetect', 1, time() + (int)eZINI::instance()->variable( 'SiteAccessSettings', 'MobileDeviceDetectCookieTimeout' ), '/' );

            $http->redirect( eZSys::indexDir() );

            eZExecution::cleanExit();
        }

        if ( !isset( $_COOKIE['eZMobileDeviceDetect'] )
                && !in_array( $currentSiteAccess['name'], eZINI::instance()->variable( 'SiteAccessSettings', 'MobileSiteAccessList'  ) ) )
        {
            $currentUrl = eZSys::serverURL() . eZSys::requestURI();
            $redirectUrl = eZINI::instance()->variable( 'SiteAccessSettings', 'MobileSiteAccessURL' );

            // Do not redirect if already on the redirect url
            if ( strpos( $currentUrl, $redirectUrl ) !== 0 )
            {
                // Default siteaccess name needs to be removed from the uri when redirecting
                $uri = explode( '/', ltrim( eZSys::requestURI(), '/' ) );

                if ( array_shift( $uri ) == $currentSiteAccess['name'] )
                {
                    $http->redirect( $redirectUrl . '/' . implode( '/', $uri ) . eZSys::queryString() );
                }
                else
                {
                    $http->redirect( $redirectUrl . eZSys::requestURI() . eZSys::queryString() );
                }
            }

            eZExecution::cleanExit();
        }
    }
674406
private function errorRedirectResponse()
    {
        $queryParams = $this->getLtiErrorMessage()->getUrlParams();
        $url = $this->getRedirectUrl($queryParams);

        $this->ltiRedirect($url);
    }
484665
public static function to()
    {
        // Is what we're providing a URL object?
        $args = func_get_args();
        if (is_object($args[0]) && $args[0] instanceof UrlInterface) {
            $url = $args[0];
        } else {
            $url = call_user_func_array('\URL::to', func_get_args());
        }
        $r = static::createRedirectResponse((string) $url, 302, array());

        return $r;
    }
298863
public function handler(): Response
    {
        $extension = Extension::findBy([
            'vendor' => $this->getParameter('vendor'),
            'package' => $this->getParameter('package')
        ]);
        if (!$extension) {
            throw new HttpForbiddenException();
        }
        $extension->uninstall();
        $this->log('info', 'Uninstall extension [' . $extension->getPackage() . ']');
        return response();
    }
1179325
public function redirect()
    {
        if (!$this->isStateless()) {
            $this->request->getSession()->put(
                'oauth.temp', $temp = $this->server->getTemporaryCredentials()
            );
        } else {
            $temp = $this->server->getTemporaryCredentials();
            $this->request->session()->put('oauth_temp', serialize($temp));
        }

        return new RedirectResponse($this->server->getAuthorizationUrl($temp));
    }