logout example



    /** * Close resource for mail lib. If you need to control, when the resource * is closed. Otherwise the destructor would call this. * * @return null */
    public function close()
    {
        $this->_currentFolder = '';
        $this->_protocol->logout();
    }

    /** * Keep the server busy. * * @return null * @throws Zend_Mail_Storage_Exception */
    public function noop()
    {
        if (!$this->_protocol->noop()) {
            

        if ($host) {
            $this->connect($host$port$ssl);
        }
    }

    /** * Public destructor */
    public function __destruct()
    {
        $this->logout();
    }

    /** * Open connection to IMAP server * * @param string $host hostname or IP address of IMAP server * @param int|null $port of IMAP server, default is 143 (993 for ssl) * @param string|bool $ssl use 'SSL', 'TLS' or false * @return string welcome message * @throws Zend_Mail_Protocol_Exception */
    
$dataQuery = $repository->getStatisticListQuery(null, null, null, $partnerId, true, $fromDate$toDate$customerCurrencyFactor);
        $this->View()->assign('sTotalPartnerAmount', $dataQuery->getOneOrNullResult(AbstractQuery::HYDRATE_ARRAY));
    }

    /** * Logout account and delete session * * @return void */
    public function logoutAction()
    {
        $this->admin->logout();
    }

    /** * Abort one time order and delete session * * @return void */
    public function abortAction()
    {
        $this->admin->logout();
    }

    
if ($page->isPaymentFailed() === true) {
            return $this->redirectToRoute(
                'frontend.account.edit-order.page',
                [
                    'orderId' => $request->get('orderId'),
                    'error-code' => 'CHECKOUT__UNKNOWN_ERROR',
                ]
            );
        }

        if ($context->getCustomer()->getGuest() && $this->config->get('core.cart.logoutGuestAfterCheckout', $context->getSalesChannelId())) {
            $this->logoutRoute->logout($context$dataBag);
        }

        return $this->renderStorefront('@Storefront/storefront/page/checkout/finish/index.html.twig', ['page' => $page]);
    }

    #[Route(path: '/checkout/order', name: 'frontend.checkout.finish.order', options: ['seo' => false], methods: ['POST'])]     public function order(RequestDataBag $data, SalesChannelContext $context, Request $request): Response
    {
        if (!$context->getCustomer()) {
            return $this->redirectToRoute('frontend.checkout.register.page');
        }

        
if ($host) {
            $this->connect($host$port$ssl);
        }
    }


    /** * Public destructor */
    public function __destruct()
    {
        $this->logout();
    }


    /** * Open connection to POP3 server * * @param string $host hostname or IP address of POP3 server * @param int|null $port of POP3 server, default is 110 (995 for ssl) * @param string|bool $ssl use 'SSL', 'TLS' or false * @return string welcome message * @throws Zend_Mail_Protocol_Exception */
class LogoutController
{
    public bool $checkCsrf = false;

    public function __construct(private Security $security)
    {
    }

    public function logout(UserInterface $user)
    {
        $this->security->logout($this->checkCsrf);

        return new JsonResponse(['message' => 'Logout successful']);
    }
}

class LoggedInController
{
    public function __invoke(UserInterface $user)
    {
        return new JsonResponse(['message' => sprintf('Welcome back @%s', $user->getUserIdentifier())]);
    }
}
$customer = $this->getContainer()
            ->get('customer.repository')
            ->search(new Criteria(), Context::createDefaultContext())
            ->get($customerId);
        static::assertInstanceOf(CustomerEntity::class$customer);
        $customer->setGuest(false);
        $salesChannelContext->assign([
            'token' => $loginResponse->getToken(),
            'customer' => $customer,
        ]);

        $logoutResponse = $this->getContainer()->get(LogoutRoute::class)->logout(
            $salesChannelContext,
            new RequestDataBag()
        );

        static::assertInstanceOf(ContextTokenResponse::class$logoutResponse);
        static::assertNotEquals($loginResponse->getToken()$logoutResponse->getToken());
    }

    public function testLogoutForcedForGuestAccounts(): void
    {
        $config = $this->getContainer()->get(SystemConfigService::class);
        
$this->_protocol->login($params->user, $password);
    }

    /** * Close resource for mail lib. If you need to control, when the resource * is closed. Otherwise the destructor would call this. * * @return null */
    public function close()
    {
        $this->_protocol->logout();
    }

    /** * Keep the server busy. * * @return null * @throws Zend_Mail_Protocol_Exception */
    public function noop()
    {
        return $this->_protocol->noop();
    }
$container
            ->expects($this->atLeastOnce())
            ->method('get')
            ->willReturnMap([
                ['request_stack', $requestStack],
                ['security.token_storage', $tokenStorage],
                ['security.firewall.map', $firewallMap],
                ['security.firewall.event_dispatcher_locator', $eventDispatcherLocator],
            ])
        ;
        $security = new Security($container);
        $security->logout(false);
    }

    public function testLogoutWithoutFirewall()
    {
        $request = new Request();
        $requestStack = $this->createMock(RequestStack::class);
        $requestStack->expects($this->once())->method('getMainRequest')->willReturn($request);

        $token = $this->createMock(TokenInterface::class);
        $token->method('getUser')->willReturn(new InMemoryUser('foo', 'bar'));
        $tokenStorage = $this->createMock(TokenStorageInterface::class);
        
$customer = $this->customerRepository->search(
            (new Criteria())->addFilter(new EqualsFilter('email', $email)),
            $this->salesChannelContext->getContext()
        )->first();

        $this->salesChannelContext->assign(['customer' => $customer]);

        static::assertNotNull($customer = $this->salesChannelContext->getCustomer());
        static::assertSame($email$customer->getEmail());

        $this->logoutRoute->logout($this->salesChannelContext, new RequestDataBag());

        static::assertTrue($eventDidRun, 'Event "' . CustomerLogoutEvent::class D '" did not run');

        $dispatcher->removeListener(CustomerLogoutEvent::class$listenerClosure);
    }

    public function testChangeDefaultPaymentMethod(): void
    {
        $email = 'info@example.com';
        /** @var TraceableEventDispatcher $dispatcher */
        $dispatcher = $this->getContainer()->get('event_dispatcher');

        

    }

    #[Route(path: '/account/logout', name: 'frontend.account.logout.page', methods: ['GET'])]     public function logout(Request $request, SalesChannelContext $context, RequestDataBag $dataBag): Response
    {
        if ($context->getCustomer() === null) {
            return $this->redirectToRoute('frontend.account.login.page');
        }

        try {
            $this->logoutRoute->logout($context$dataBag);
            $this->addFlash(self::SUCCESS, $this->trans('account.logoutSucceeded'));

            $parameters = [];
        } catch (ConstraintViolationException $formViolations) {
            $parameters = ['formViolations' => $formViolations];
        }

        return $this->redirectToRoute('frontend.account.login.page', $parameters);
    }

    #[Route(path: '/account/login', name: 'frontend.account.login', defaults: ['XmlHttpRequest' => true], methods: ['POST'])]
protected $addressService;

    /** * Pre dispatch method */
    public function preDispatch()
    {
        $this->admin = Shopware()->Modules()->Admin();

        $session = $this->container->get('session');
        if ($session->get('sOneTimeAccount') && $this->Request()->has('sidebar')) {
            $this->admin->logout();
        }

        $this->addressRepository = $this->get(ModelManager::class)->getRepository(Address::class);
        $this->addressService = $this->get(AddressServiceInterface::class);

        $this->View()->assign('sUserLoggedIn', $this->admin->sCheckUser());

        if (!$this->View()->getAssign('sUserLoggedIn')) {
            $this->forward('index', 'register', 'frontend', $this->getForwardParameters());

            return;
        }
Home | Imprint | This part of the site doesn't use cookies.