Skip to content

Commit

Permalink
Merge pull request #1 from scommercemage/SCOM-949
Browse files Browse the repository at this point in the history
Scom 949
  • Loading branch information
scommercemage authored Feb 5, 2024
2 parents 16c66de + 18933b2 commit aee40d3
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 6 deletions.
33 changes: 33 additions & 0 deletions Controller/Adminhtml/WrongLicense/Index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Scommerce\SecurityBase\Controller\Adminhtml\WrongLicense;

use Magento\Backend\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;
use Magento\Backend\App\Action;

class Index extends Action
{
public $resultPageFactory;

/**
* Index constructor.
* @param Context $context
* @param PageFactory $resultPageFactory
*/
public function __construct(
Context $context,
PageFactory $resultPageFactory
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}

public function execute()
{
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
$resultPage = $this->resultPageFactory->create();

return $resultPage;
}
}
21 changes: 17 additions & 4 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Magento\Framework\App\Helper\Context;
use Magento\Framework\Model\Exception;
use Magento\Store\Model\ScopeInterface;
use Magento\Framework\Controller\ResultFactory;

class Data extends AbstractHelper
{
Expand All @@ -36,17 +37,21 @@ class Data extends AbstractHelper
*/
protected $_coreHelper;

/** @var ResultFactory */
protected $resultFactory;

/**
* @param Context $context
* @param CoreHelper $coreHelper
*/
public function __construct(
Context $context,
CoreHelper $coreHelper
)
{
$this->_coreHelper = $coreHelper;
CoreHelper $coreHelper,
ResultFactory $resultFactory
) {
parent::__construct($context);
$this->_coreHelper = $coreHelper;
$this->resultFactory = $resultFactory;
}

/**
Expand All @@ -60,6 +65,14 @@ public function isEnabled($storeId = null)
return $this->isCliMode() ? $enabled : $enabled && $this->isLicenseValid();
}

public function getNoRouteRedirect()
{
$redirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
$redirectUrl = "scommercesecurity/wronglicense/index";
$redirect->setPath($redirectUrl);
return $redirect;
}

/**
* Returns license key administration configuration option
* @param int $storeId
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"type": "magento2-module",
"license": "Commercial",
"version": "2.0.0",
"version": "2.0.1",
"authors": [
{
"name": "Scommerce Mage",
Expand Down
8 changes: 8 additions & 0 deletions etc/adminhtml/routes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="scommercesecurity" frontName="scommercesecurity">
<module name="Scommerce_SecurityBase" before="Magento_Backend" />
</route>
</router>
</config>
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Scommerce_SecurityBase" setup_version="2.0.0">
<module name="Scommerce_SecurityBase" setup_version="2.0.1">
<sequence>
<module name="Scommerce_Core"/>
</sequence>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Magento\Framework\View\Element\Template" template="Scommerce_SecurityBase::wronglicense.phtml" name="scommerce-security-wronglicense">
</block>
</referenceContainer>
</body>
</page>
1 change: 1 addition & 0 deletions view/adminhtml/templates/wronglicense.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Extension is disabled or license key is invalid</h1>

0 comments on commit aee40d3

Please sign in to comment.