Ecomwise_Forcelogin - Version 0.1.0

Version Notes

0.1.0

Download this release

Release Info

Developer EcomwiseTeam
Extension Ecomwise_Forcelogin
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/Ecomwise/Forcelogin/Block/System/Config/Version.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ecomwise_Forcelogin_Block_System_Config_Version extends Mage_Adminhtml_Block_System_Config_Form_Field{
3
+
4
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
5
+ return (string) "v".Mage::getConfig()->getNode()->modules->Ecomwise_Forcelogin->version;
6
+ }
7
+ }
app/code/community/Ecomwise/Forcelogin/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ecomwise_Forcelogin_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/Ecomwise/Forcelogin/Model/Observer.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ecomwise_Forcelogin_Model_Observer extends Varien_Object{
3
+
4
+ public function forceLogin($observer){
5
+
6
+ //echo Mage::helper("core/url")->getCurrentUrl(); return;
7
+ //echo Mage::app()->getRequest()->getActionName(); exit;
8
+ //echo Mage::app()->getRequest()->getRouteName(); exit;
9
+
10
+ $forceLogin = (bool) Mage::getStoreConfig('forcelogin/forcelogin/disable_ext', Mage::app()->getStore());
11
+ if(!$forceLogin){
12
+ if ( ! Mage::getSingleton('customer/session')->isLoggedIn()
13
+ && ! Mage::getSingleton('admin/session')->isLoggedIn()
14
+ && Mage::app()->getRequest()->getModuleName() !== 'admin'
15
+ && Mage::app()->getRequest()->getModuleName() !== 'api'
16
+ && Mage::app()->getRequest()->getControllerName() !== 'account') {
17
+ $session = Mage::getSingleton("customer/session");
18
+ $session->setBeforeAuthUrl(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).'home');
19
+ Mage::app()->getResponse()
20
+ ->setRedirect(Mage::helper('adminhtml')
21
+ ->getUrl("customer/account/login", array('_type' => 'direct_link')));
22
+
23
+ }
24
+
25
+ }
26
+ }
27
+
28
+ }
29
+
app/code/community/Ecomwise/Forcelogin/etc/config.xml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ecomwise_Forcelogin>
5
+ <version>0.1.0</version>
6
+ </Ecomwise_Forcelogin>
7
+
8
+ </modules>
9
+
10
+ <global>
11
+ <models>
12
+ <forcelogin>
13
+ <class>Ecomwise_Forcelogin_Model</class>
14
+ </forcelogin>
15
+ </models>
16
+
17
+ <blocks>
18
+ <forcelogin>
19
+ <class>Ecomwise_Forcelogin_Block</class>
20
+ </forcelogin>
21
+ </blocks>
22
+ <helpers>
23
+ <forcelogin>
24
+ <class>Ecomwise_Forcelogin_Helper</class>
25
+ </forcelogin>
26
+ </helpers>
27
+
28
+ <events>
29
+ <controller_action_postdispatch>
30
+ <observers>
31
+ <forcelogin_model_observer>
32
+ <type>singleton</type>
33
+ <class>Ecomwise_Forcelogin_Model_Observer</class>
34
+ <method>forceLogin</method>
35
+ </forcelogin_model_observer>
36
+ </observers>
37
+ </controller_action_postdispatch>
38
+ </events>
39
+ </global>
40
+ <adminhtml>
41
+ <acl>
42
+ <resources>
43
+ <all>
44
+ <title>Allow Everything</title>
45
+ </all>
46
+ <admin>
47
+ <children>
48
+ <system>
49
+ <children>
50
+ <config>
51
+ <children>
52
+ <forcelogin translate="title" module="forcelogin">
53
+ <title>Forced Login</title>
54
+ </forcelogin>
55
+ </children>
56
+ </config>
57
+ </children>
58
+ </system>
59
+ </children>
60
+ </admin>
61
+ </resources>
62
+ </acl>
63
+ </adminhtml>
64
+ </config>
app/code/community/Ecomwise/Forcelogin/etc/system.xml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <tabs>
5
+ <ecomwise translate="label">
6
+ <label>B2B-extensions</label>
7
+ <sort_order>100</sort_order>
8
+ </ecomwise>
9
+ </tabs>
10
+ <sections>
11
+ <forcelogin translate="label" module="forcelogin">
12
+ <label>Forced Login</label>
13
+ <tab>ecomwise</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>90</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <forcelogin translate="label">
21
+ <label>Info</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>1</sort_order>
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
+ <fields>
28
+ <forcelogin_version translate="label">
29
+ <label>Forced Login</label>
30
+ <frontend_type>select</frontend_type>
31
+ <frontend_model>forcelogin/system_config_version</frontend_model>
32
+ <sort_order>1</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </forcelogin_version>
37
+ <disable_ext translate="label">
38
+ <label>Disable</label>
39
+ <frontend_type>select</frontend_type>
40
+ <source_model>adminhtml/system_config_source_yesno</source_model>
41
+ <sort_order>10</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ </disable_ext>
46
+ </fields>
47
+ </forcelogin>
48
+ </groups>
49
+ </forcelogin>
50
+ </sections>
51
+ </config>
app/etc/modules/Ecomwise_Forcelogin.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Ecomwise_Forcelogin>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Ecomwise_Forcelogin>
8
+ </modules>
9
+ </config>
10
+
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Ecomwise_Forcelogin</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL-3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Ecomwise_Forcelogin</summary>
10
+ <description>Ecomwise_Forcelogin</description>
11
+ <notes>0.1.0</notes>
12
+ <authors><author><name>EcomwiseTeam</name><user>EcomwiseTeam</user><email>info@experius.nl</email></author></authors>
13
+ <date>2013-01-11</date>
14
+ <time>07:59:06</time>
15
+ <contents><target name="magecommunity"><dir><dir name="Ecomwise"><dir name="Forcelogin"><dir name="Block"><dir name="System"><dir name="Config"><file name="Version.php" hash="e5ea1ca5d03c0d3fce4f91144c35c05c"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="529c0c5b3186eae81d6ee9a3fb900214"/></dir><dir name="Model"><file name="Observer.php" hash="40c979628682913861e6f2417dfba10c"/></dir><dir name="etc"><file name="config.xml" hash="7870d2b805342652ff8c49c4ea913612"/><file name="system.xml" hash="beb7b227f4a299b509532711913db446"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Ecomwise_Forcelogin.xml" hash="3a880ecb645874100851c30a0d09fb2a"/></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.0.0</min><max>5.4.8</max></php></required></dependencies>
18
+ </package>