Strategery_Deny - Version 0.1.0

Version Notes

Master user and password for frontend.

Download this release

Release Info

Developer Magento Core Team
Extension Strategery_Deny
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/Strategery/Deny/Helper/Data.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * Strategery-Deny - Magento Extension
6
+ *
7
+ * @copyright Copyright (c) 2015 DwDesigner Inc. (http://www.dwdeveloper.com/)
8
+ * @author Damian A. Pastorini - damian.pastorini@dwdeveloper.com
9
+ *
10
+ */
11
+
12
+ class Strategery_Deny_Helper_Data extends Mage_Core_Helper_Abstract
13
+ {
14
+
15
+ }
app/code/community/Strategery/Deny/Model/Observer.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * Strategery-Deny - Magento Extension
6
+ *
7
+ * @copyright Copyright (c) 2015 DwDesigner Inc. (http://www.dwdeveloper.com/)
8
+ * @author Damian A. Pastorini - damian.pastorini@dwdeveloper.com
9
+ *
10
+ */
11
+
12
+ class Strategery_Deny_Model_Observer
13
+ {
14
+
15
+ public function requireLogin($observer)
16
+ {
17
+ $session = Mage::getSingleton('core/session');
18
+ $enabled = Mage::getStoreConfig('strategery_deny/general/enabled');
19
+ if ($enabled && !$session->getAccessGranted()) {
20
+ $controllerAction = $observer->getEvent()->getControllerAction();
21
+ /* @var $controllerAction Mage_Core_Controller_Front_Action */
22
+ $requestString = $controllerAction->getRequest()->getRequestString();
23
+ $session->setBeforeAuthUrl($requestString);
24
+ if($requestString != '/frontaccess/login/') {
25
+ $controllerAction->getResponse()->setRedirect(Mage::getUrl('frontaccess/login'));
26
+ $controllerAction->getResponse()->sendResponse();
27
+ exit();
28
+ }
29
+ }
30
+ }
31
+
32
+ }
app/code/community/Strategery/Deny/controllers/LoginController.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * Strategery-Deny - Magento Extension
6
+ *
7
+ * @copyright Copyright (c) 2015 DwDesigner Inc. (http://www.dwdeveloper.com/)
8
+ * @author Damian A. Pastorini - damian.pastorini@dwdeveloper.com
9
+ *
10
+ */
11
+
12
+ class Strategery_Deny_LoginController extends Mage_Core_Controller_Front_Action
13
+ {
14
+
15
+ public function indexAction()
16
+ {
17
+ if($this->getRequest()->isPost()) {
18
+ $user = Mage::getStoreConfig('strategery_deny/general/user');
19
+ $password = Mage::getStoreConfig('strategery_deny/general/password');
20
+ $postData = $this->getRequest()->getPost();
21
+ $session = Mage::getSingleton('core/session');
22
+ if($user == $postData['user'] && $password == $postData['password']) {
23
+ $session->setAccessGranted(true);
24
+ return $this->_redirectUrl(Mage::getBaseUrl());
25
+ } else {
26
+ $errorMessage = Mage::helper('strategery_deny')->__('Login error.');
27
+ $session->addError($errorMessage);
28
+ }
29
+ }
30
+ $this->loadLayout()->renderLayout();
31
+ }
32
+
33
+ }
app/code/community/Strategery/Deny/etc/adminhtml.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ *
5
+ * Strategery-Deny - Magento Extension
6
+ *
7
+ * @copyright Copyright (c) 2015 DwDesigner Inc. (http://www.dwdeveloper.com/)
8
+ * @author Damian A. Pastorini - damian.pastorini@dwdeveloper.com
9
+ *
10
+ */
11
+ -->
12
+ <config>
13
+ <acl>
14
+ <resources>
15
+ <admin>
16
+ <children>
17
+ <system>
18
+ <children>
19
+ <config>
20
+ <children>
21
+ <strategery_deny translate="title" module="strategery_deny">
22
+ <title>Strategery Extensions - Deny Front Access</title>
23
+ <sort_order>50</sort_order>
24
+ </strategery_deny>
25
+ </children>
26
+ </config>
27
+ </children>
28
+ </system>
29
+ </children>
30
+ </admin>
31
+ </resources>
32
+ </acl>
33
+ </config>
app/code/community/Strategery/Deny/etc/config.xml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ *
5
+ * Strategery-Deny - Magento Extension
6
+ *
7
+ * @copyright Copyright (c) 2015 DwDesigner Inc. (http://www.dwdeveloper.com/)
8
+ * @author Damian A. Pastorini - damian.pastorini@dwdeveloper.com
9
+ *
10
+ */
11
+ -->
12
+ <config>
13
+ <modules>
14
+ <Strategery_Deny>
15
+ <version>0.1.0</version>
16
+ </Strategery_Deny>
17
+ </modules>
18
+ <global>
19
+ <models>
20
+ <strategery_deny>
21
+ <class>Strategery_Deny_Model</class>
22
+ <resourceModel>strategery_deny_resource</resourceModel>
23
+ </strategery_deny>
24
+ </models>
25
+ <helpers>
26
+ <strategery_deny>
27
+ <class>Strategery_Deny_Helper</class>
28
+ </strategery_deny>
29
+ </helpers>
30
+ </global>
31
+ <default>
32
+ <strategery_deny>
33
+ <general>
34
+ <enabled>0</enabled>
35
+ </general>
36
+ </strategery_deny>
37
+ </default>
38
+ <frontend>
39
+ <routers>
40
+ <strategery_deny>
41
+ <use>standard</use>
42
+ <args>
43
+ <module>Strategery_Deny</module>
44
+ <frontName>frontaccess</frontName>
45
+ </args>
46
+ </strategery_deny>
47
+ </routers>
48
+ <layout>
49
+ <updates>
50
+ <strategery_deny>
51
+ <file>strategery_deny.xml</file>
52
+ </strategery_deny>
53
+ </updates>
54
+ </layout>
55
+ <events>
56
+ <controller_action_predispatch>
57
+ <observers>
58
+ <strategery_deny>
59
+ <class>Strategery_Deny_Model_Observer</class>
60
+ <method>requireLogin</method>
61
+ </strategery_deny>
62
+ </observers>
63
+ </controller_action_predispatch>
64
+ </events>
65
+ </frontend>
66
+ </config>
app/code/community/Strategery/Deny/etc/system.xml ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ *
5
+ * Strategery-Deny - Magento Extension
6
+ *
7
+ * @copyright Copyright (c) 2015 DwDesigner Inc. (http://www.dwdeveloper.com/)
8
+ * @author Damian A. Pastorini - damian.pastorini@dwdeveloper.com
9
+ *
10
+ */
11
+ -->
12
+ <config>
13
+ <tabs>
14
+ <strategery_all translate="label">
15
+ <label>Strategery Extensions</label>
16
+ <sort_order>300</sort_order>
17
+ </strategery_all>
18
+ </tabs>
19
+ <sections>
20
+ <strategery_deny translate="label">
21
+ <label>Deny Front-Access</label>
22
+ <tab>strategery_all</tab>
23
+ <frontend_type>text</frontend_type>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <groups>
28
+ <general translate="label">
29
+ <label>General</label>
30
+ <sort_order>1</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ <fields>
35
+ <enabled translate="label">
36
+ <label>Enabled</label>
37
+ <frontend_type>select</frontend_type>
38
+ <source_model>adminhtml/system_config_source_yesno</source_model>
39
+ <sort_order>1</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </enabled>
44
+ <user translate="label">
45
+ <label>User</label>
46
+ <frontend_type>text</frontend_type>
47
+ <sort_order>2</sort_order>
48
+ <show_in_default>1</show_in_default>
49
+ <show_in_website>1</show_in_website>
50
+ <show_in_store>1</show_in_store>
51
+ </user>
52
+ <password translate="label">
53
+ <label>Password</label>
54
+ <frontend_type>password</frontend_type>
55
+ <sort_order>3</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>1</show_in_store>
59
+ </password>
60
+ </fields>
61
+ </general>
62
+ </groups>
63
+ </strategery_deny>
64
+ </sections>
65
+ </config>
app/design/frontend/base/default/layout/strategery_deny.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ *
5
+ * Strategery-Deny - Magento Extension
6
+ *
7
+ * @copyright Copyright (c) 2015 DwDesigner Inc. (http://www.dwdeveloper.com/)
8
+ * @author Damian A. Pastorini - damian.pastorini@dwdeveloper.com
9
+ *
10
+ */
11
+ -->
12
+ <layout version="0.1.0">
13
+
14
+ <strategery_deny_login_index>
15
+ <reference name="root">
16
+ <action method="setTemplate">
17
+ <template>strategery/deny/login.phtml</template>
18
+ </action>
19
+ </reference>
20
+ </strategery_deny_login_index>
21
+
22
+ </layout>
app/design/frontend/base/default/template/strategery/deny/login.phtml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * Strategery-Deny - Magento Extension
5
+ *
6
+ * @copyright Copyright (c) 2015 DwDesigner Inc. (http://www.dwdeveloper.com/)
7
+ * @author Damian A. Pastorini - damian.pastorini@dwdeveloper.com
8
+ *
9
+ */
10
+ ?>
11
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
13
+ <head>
14
+ <?php echo $this->getChildHtml('head') ?>
15
+ </head>
16
+ <body<?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
17
+ <div class="wrapper">
18
+ <div class="page">
19
+ <div class="main-container col2-layout">
20
+ <div class="main">
21
+ <div class="col-main">
22
+ <div class="account-login container">
23
+ <div class="page-title">
24
+ <h1><?php echo $this->__('Front Access') ?></h1>
25
+ </div>
26
+ <?php echo $this->getChildHtml('global_messages') ?>
27
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
28
+ <form action="<?php echo Mage::getUrl('frontaccess/login'); ?>" method="post" id="frontaccess-form">
29
+ <div class="col1-set">
30
+ <div class="col-1">
31
+ <div class="content">
32
+ <h2><?php echo $this->__('Login') ?></h2>
33
+ <ul class="form-list">
34
+ <li>
35
+ <label for="user" class="required"><em>*</em><?php echo $this->__('User') ?></label>
36
+ <div class="input-box">
37
+ <input type="text" name="user" id="user" class="input-text required-entry" title="<?php echo Mage::helper('core')->quoteEscape($this->__('User')) ?>"/>
38
+ </div>
39
+ </li>
40
+ <li>
41
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
42
+ <div class="input-box">
43
+ <input type="password" name="password" class="input-text required-entry" id="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Password')) ?>" />
44
+ </div>
45
+ </li>
46
+ </ul>
47
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ <div class="col1-set">
52
+ <div class="col-1 registered-users">
53
+ <div class="buttons-set">
54
+ <button type="submit" class="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Login')) ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </form>
59
+ <script type="text/javascript">
60
+ //<![CDATA[
61
+ var dataForm = new VarienForm('frontaccess-form', true);
62
+ //]]>
63
+ </script>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </div>
70
+ </body>
71
+ </html>
app/etc/modules/Strategery_Deny.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ *
5
+ * Strategery-Deny - Magento Extension
6
+ *
7
+ * @copyright Copyright (c) 2015 DwDesigner Inc. (http://www.dwdeveloper.com/)
8
+ * @author Damian A. Pastorini - damian.pastorini@dwdeveloper.com
9
+ *
10
+ */
11
+ -->
12
+ <config>
13
+ <modules>
14
+ <Strategery_Deny>
15
+ <active>true</active>
16
+ <codePool>community</codePool>
17
+ </Strategery_Deny>
18
+ </modules>
19
+ </config>
package.xml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Strategery_Deny</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/afl-3.0.php">Academic Free License (AFL 3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Strategery - Deny allow administrators to setup a master user and password for the entire frontend.</summary>
10
+ <description>&lt;h1&gt;Strategery - Deny&lt;/h1&gt;&#xD;
11
+ &lt;h2&gt;Features&lt;/h2&gt;&#xD;
12
+ &lt;p&gt;Allow administrators to setup a master user and password for the entire frontend.&lt;/p&gt;&#xD;
13
+ &lt;h3&gt;How this works?&lt;/h3&gt;&#xD;
14
+ &lt;p&gt;Pretty easy it validates the user / password with the one configured in the system configuration and set a session to let the user navigate the frontend.&lt;/p&gt;&#xD;
15
+ &lt;h2&gt;How to use it in simple steps:&lt;/h2&gt;&#xD;
16
+ &lt;ul&gt;&#xD;
17
+ &lt;li&gt;Go to System / Configuration / Strategery Extensions / Deny&lt;/li&gt;&#xD;
18
+ &lt;li&gt;Enable the extension&lt;/li&gt;&#xD;
19
+ &lt;li&gt;Configure your master user and password&lt;/li&gt;&#xD;
20
+ &lt;li&gt;Enjoy!&lt;/li&gt;&#xD;
21
+ &lt;/ul&gt;&#xD;
22
+ &lt;h2&gt;Supported versions&lt;/h2&gt;&#xD;
23
+ &lt;p&gt;Magento 1.7.x to 1.9.x.&lt;/p&gt;&#xD;
24
+ &lt;h2&gt;Support&lt;/h2&gt;&#xD;
25
+ &lt;p&gt;For support, contact us at &lt;a href="mailto:contact@usestrategery.com"&gt;contact@usestrategery.com&lt;/a&gt;&lt;/p&gt;</description>
26
+ <notes>Master user and password for frontend.</notes>
27
+ <authors><author><name>Strategery</name><user>auto-converted</user><email>contact@usestrategery.com</email></author><author><name>Damian A. Pastorini</name><user>auto-converted</user><email>damian.pastorini@dwdeveloper.com</email></author></authors>
28
+ <date>2015-05-12</date>
29
+ <time>14:18:40</time>
30
+ <contents><target name="mageetc"><dir name="modules"><file name="Strategery_Deny.xml" hash="ba4aec129a8111e1ceb5a15c71379e23"/></dir></target><target name="magecommunity"><dir name="Strategery"><dir name="Deny"><dir name="Helper"><file name="Data.php" hash="b1f84b1e5eb6022fe09671b00c8cb266"/></dir><dir name="Model"><file name="Observer.php" hash="6d7c9db1d67f52fe1688417847f58bda"/></dir><dir name="controllers"><file name="LoginController.php" hash="3fde0e4c1f45a5e9cf4930d9ef8ea912"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8861012f90a0277ea75f5617edad7eba"/><file name="config.xml" hash="f1bfa1819a8e1c72afc591b2062ec72e"/><file name="system.xml" hash="f9898eccdebfa627a0dbc83c763e780b"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="strategery_deny.xml" hash="8498fc3d89028e919067ed00fb29ba44"/></dir><dir name="template"><dir name="strategery"><dir name="deny"><file name="login.phtml" hash="13b588d4d18e5cf420c26ed735d6c7d3"/></dir></dir></dir></dir></dir></dir></target></contents>
31
+ <compatible/>
32
+ <dependencies/>
33
+ </package>