DeniedIframe.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Backend\Controller\Adminhtml\Auth;
  8. class DeniedIframe extends \Magento\Backend\Controller\Adminhtml\Auth
  9. {
  10. /**
  11. * @var \Magento\Framework\Controller\Result\RawFactory
  12. */
  13. protected $resultRawFactory;
  14. /**
  15. * @param \Magento\Backend\App\Action\Context $context
  16. * @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
  17. */
  18. public function __construct(
  19. \Magento\Backend\App\Action\Context $context,
  20. \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
  21. ) {
  22. parent::__construct($context);
  23. $this->resultRawFactory = $resultRawFactory;
  24. }
  25. /**
  26. * Retrieve response for deniedIframeAction()
  27. *
  28. * @return string
  29. */
  30. protected function _getDeniedIframe()
  31. {
  32. return '<script>parent.window.location = \''
  33. . $this->_helper->getHomePageUrl() . '\';</script>';
  34. }
  35. /**
  36. * Denied IFrame action
  37. *
  38. * @return \Magento\Framework\Controller\Result\Raw
  39. */
  40. public function execute()
  41. {
  42. /** @var \Magento\Framework\Controller\Result\Raw $resultRaw */
  43. $resultRaw = $this->resultRawFactory->create();
  44. return $resultRaw->setContents($this->_getDeniedIframe());
  45. }
  46. }