CardsManagement.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Vault\Controller;
  7. use Magento\Customer\Model\Session;
  8. use Magento\Framework\App\Action\Context;
  9. use Magento\Framework\App\RequestInterface;
  10. use Magento\Framework\App\ResponseInterface;
  11. use Magento\Framework\Exception\NotFoundException;
  12. abstract class CardsManagement extends \Magento\Framework\App\Action\Action
  13. {
  14. /**
  15. * @var Session
  16. */
  17. protected $customerSession;
  18. /**
  19. * @param Context $context
  20. * @param Session $customerSession
  21. */
  22. public function __construct(
  23. Context $context,
  24. Session $customerSession
  25. ) {
  26. parent::__construct($context);
  27. $this->customerSession = $customerSession;
  28. }
  29. /**
  30. * Dispatch request
  31. *
  32. * @param RequestInterface $request
  33. * @return ResponseInterface
  34. * @throws NotFoundException
  35. */
  36. public function dispatch(RequestInterface $request)
  37. {
  38. if (!$this->customerSession->authenticate()) {
  39. $this->_actionFlag->set('', 'no-dispatch', true);
  40. }
  41. return parent::dispatch($request);
  42. }
  43. }