Ecomwise_Forcelogin - Version 1.1.3

Version Notes

1.1.3

Download this release

Release Info

Developer EcomwiseTeam
Extension Ecomwise_Forcelogin
Version 1.1.3
Comparing to
See all releases


Code changes from version 1.0.5 to 1.1.3

app/code/community/Ecomwise/Base/Block/NotificationsNotifier/System/Config/Form/Fieldset/Ecomwise/Extensions.php CHANGED
File without changes
app/code/community/Ecomwise/Base/Helper/Data.php CHANGED
File without changes
app/code/community/Ecomwise/Base/Model/ExtensionsLicencer/Observer.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
  class Ecomwise_Base_Model_ExtensionsLicencer_Observer {
3
 
4
  const EXTENSION_USE_HTTPS_PATH = 'base/licencer/use_https';
@@ -11,18 +11,61 @@ class Ecomwise_Base_Model_ExtensionsLicencer_Observer {
11
  }
12
 
13
  $domain = parse_url(Mage::getStoreConfig(Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_URL));
 
14
  $extensions = $this->getInstalledExtensions();
15
- foreach($extensions as $key => $extension){
16
- if($extension != "base"){
17
- $license_number = Mage::getStoreConfig($extension . "/settings/serial");
18
- $response = $this->getServerResponse($extension, $domain["host"], $license_number);
19
- $this->setExtensionOutput($key, $response);
20
- $this->setExtensionStatus($extension, $response);
21
- $this->setExtensionWarning($extension, $response);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  }
23
  }
24
-
25
- Mage::app()->getStore()->resetConfig();
26
  $this->setLastUpdate();
27
 
28
  return $this;
@@ -31,71 +74,73 @@ class Ecomwise_Base_Model_ExtensionsLicencer_Observer {
31
  public function showAdminMessages(){
32
  $disabled_extensions = array();
33
  $warned_extensions = array();
34
-
35
  $this->checkExtensionLicence();
36
  $extensions = $this->getInstalledExtensions();
37
- foreach($extensions as $extension){
38
- $status = Mage::getStoreConfig($extension . '/status/valid');
39
- if($status == "disable"){
40
- $disabled_extensions[] = ucfirst($extension);
41
- }
42
-
43
- $warning = Mage::getStoreConfig($extension . '/status/warning');
44
- if($warning != "" && $warning != NULL){
45
- $warned_extensions[ucfirst($extension)] = $warning;
 
 
46
  }
47
  }
48
 
49
  if(!empty($warned_extensions)){
50
  if(count($warned_extensions) > 1){
51
  $text1 = array();
52
- $text2 = array();
53
  if(count($warned_extensions) == 2){
54
  foreach($warned_extensions as $key => $value){
55
  $text1[] = $key;
56
  $text2[] = $key . " extension will be disabled in " . $value;
57
  }
58
- $text1 = implode(" and ", $text1);
59
- $text2 = implode(" and the ", $text2);
60
  }else{
61
  foreach($warned_extensions as $key => $value){
62
  $text1[] = $key;
63
  $text2[] = $key . " extension will be disabled in " . $value;
64
  }
65
  $last_element = array_pop($text1);
66
- $text1 = implode(", ", $text1) . " and " . $last_element;
67
- $last_element = array_pop($text2);
68
- $text2 = implode(", the ", $text2) . " and the " . $last_element;
69
- }
70
-
71
  $message = Mage::Helper("base")->__("Please insert the license key for the " . $text1 . " extensions. The " . $text2 . ".");
72
  }else{
73
  $text1 = min(array_keys($warned_extensions));
74
  $text2 = $warned_extensions[$text1];
75
  $message = Mage::Helper("base")->__("Please insert the license key for the " . $text1 . " extension. The extension will be disabled in " . $text2 . ".");
76
  }
77
-
78
  Mage::getSingleton('adminhtml/session')->addError($message);
79
  }
80
-
81
  if(!empty($disabled_extensions)){
82
  if(count($disabled_extensions) > 1){
83
  $text = "";
84
- if(count($disabled_extensions) == 2){
85
  $text = implode(" and ", $disabled_extensions);
86
  }else{
87
  $last_element = array_pop($disabled_extensions);
88
- $text = implode(", ", $disabled_extensions) . " and " . $last_element;
89
  }
90
  $message = Mage::Helper("base")->__("The " . $text . " extensions are disabled. Please insert the license key.");
91
  }else{
92
  $text = $disabled_extensions[0];
93
  $message = Mage::Helper("base")->__("The " . $text . " extension is disabled. Please insert the license key.");
94
- }
95
-
96
  Mage::getSingleton('adminhtml/session')->addError($message);
97
  }
98
-
99
  return $this;
100
  }
101
 
@@ -104,12 +149,42 @@ class Ecomwise_Base_Model_ExtensionsLicencer_Observer {
104
  $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
105
  sort($modules);
106
  foreach($modules as $extension){
107
- $is_enable = Mage::helper('core')->isModuleEnabled($extension);
108
- if ($is_enable === true && strstr($extension, 'Ecomwise_') !== false){
109
- $extensionName = explode("_", $extension);
110
- $ecomwise_extensions[$extension] = strtolower($extensionName[1]);
 
 
111
  }
112
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  return $ecomwise_extensions;
114
  }
115
 
@@ -120,18 +195,18 @@ class Ecomwise_Base_Model_ExtensionsLicencer_Observer {
120
 
121
  private function getServerResponse($extension, $domain, $license_number){
122
  $curl = new Varien_Http_Adapter_Curl();
123
- $curl->setConfig(array(
124
- 'timeout' => 2
125
- ));
126
 
127
  $ip_address = $this->getIpAddress();
128
  $base_version = Mage::getConfig()->getModuleConfig("Ecomwise_Base")->version;
129
- $parametars = "extension/$extension/domain/$domain/ip_address/$ip_address/licence_number/$license_number/base_version/$base_version";
 
130
  $curl->write(Zend_Http_Client::GET, $this->getLicenserUrl() . $parametars, '1.0');
131
  $data = $curl->read();
132
  if ($data === false){
133
- return "503";
134
  }
 
135
  $data = preg_split('/^\r?$/m', $data, 2);
136
  $data = str_replace("\n", "", trim($data[1]));
137
  $curl->close();
@@ -144,19 +219,19 @@ class Ecomwise_Base_Model_ExtensionsLicencer_Observer {
144
  Mage::getConfig()->saveConfig('advanced/modules_disable_output/' . $extension, $response);
145
  return $this;
146
  }
147
-
148
  private function setExtensionStatus($extension, $response){
149
  $response = isset($response["code"]) && $response["code"] == "100" ? "disable" : "active";
150
  Mage::getConfig()->saveConfig($extension . '/status/valid', $response);
151
  return $this;
152
  }
153
-
154
  private function setExtensionWarning($extension, $response){
155
  $response = isset($response["code"]) && $response["code"] == "500" ? $response["message"] : "";
156
- Mage::getConfig()->saveConfig($extension . '/status/warning', $response);
157
- return $this;
158
  }
159
-
160
  private function getIpAddress(){
161
  return isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : "";
162
  }
1
+ <?php
2
  class Ecomwise_Base_Model_ExtensionsLicencer_Observer {
3
 
4
  const EXTENSION_USE_HTTPS_PATH = 'base/licencer/use_https';
11
  }
12
 
13
  $domain = parse_url(Mage::getStoreConfig(Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_URL));
14
+ $skipped_extensions = array();
15
  $extensions = $this->getInstalledExtensions();
16
+ if($extensions){
17
+ foreach($extensions as $extension => $extension_data){
18
+ if(in_array($extension, $skipped_extensions)){
19
+ continue;
20
+ }
21
+
22
+ $license_number = Mage::getStoreConfig($extension_data["code"] . "/settings/serial");
23
+ $response = $this->getServerResponse($extension_data["code"], $domain["host"], $license_number);
24
+ $this->setExtensionOutput($extension, $response);
25
+ $this->setExtensionStatus($extension_data["code"], $response);
26
+ $this->setExtensionWarning($extension_data["code"], $response);
27
+
28
+ if($extension == "Ecomwise_B2BSuite"){
29
+ if($extension_data["current_output_status"] == "" || $extension_data["current_output_status"] == "0"){
30
+ if(isset($response["code"]) && $response["code"] == "100"){
31
+ Mage::app()->getStore()->resetConfig();
32
+ $reloaded_extensions = $this->getInstalledExtensions();
33
+ if(!empty($reloaded_extensions)){
34
+ $extensions_part_of_b2b_suite = Mage::helper("b2bsuite")->getExtensionsPartOfB2BSuite();
35
+ if(is_array($extensions_part_of_b2b_suite) && !empty($extensions_part_of_b2b_suite)){
36
+ foreach($reloaded_extensions as $reloaded_extension => $reloaded_extension_data){
37
+ if(in_array($reloaded_extension, $extensions_part_of_b2b_suite)){
38
+ $license_number = Mage::getStoreConfig($reloaded_extension_data["code"] . "/settings/serial");
39
+ $response = $this->getServerResponse($reloaded_extension_data["code"], $domain["host"], $license_number);
40
+ $this->setExtensionOutput($reloaded_extension, $response);
41
+ $this->setExtensionStatus($reloaded_extension_data["code"], $response);
42
+ $this->setExtensionWarning($reloaded_extension_data["code"], $response);
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }else if($extension_data["current_output_status"] == "1"){
49
+ if(isset($response["code"]) && $response["code"] == "200"){
50
+ $extensions_part_of_b2b_suite = Mage::helper("b2bsuite")->getExtensionsPartOfB2BSuite();
51
+ if(is_array($extensions_part_of_b2b_suite) && !empty($extensions_part_of_b2b_suite)){
52
+ foreach($extensions as $extension => $extension_data){
53
+ if(in_array($extension, $extensions_part_of_b2b_suite)){
54
+ $skipped_extensions[] = $extension;
55
+ $response = array("code" => "200", "message" => "");
56
+ $this->setExtensionOutput($extension, $response);
57
+ $this->setExtensionStatus($extension_data["code"], $response);
58
+ $this->setExtensionWarning($extension_data["code"], $response);
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
64
+ }
65
  }
66
  }
67
+
68
+ Mage::app()->getStore()->resetConfig();
69
  $this->setLastUpdate();
70
 
71
  return $this;
74
  public function showAdminMessages(){
75
  $disabled_extensions = array();
76
  $warned_extensions = array();
77
+
78
  $this->checkExtensionLicence();
79
  $extensions = $this->getInstalledExtensions();
80
+ if($extensions){
81
+ foreach($extensions as $extension => $extension_data){
82
+ $status = Mage::getStoreConfig($extension_data["code"] . '/status/valid');
83
+ if($status == "disable"){
84
+ $disabled_extensions[] = ucfirst($extension_data["code"]);
85
+ }
86
+
87
+ $warning = Mage::getStoreConfig($extension_data["code"] . '/status/warning');
88
+ if($warning != "" && $warning != NULL){
89
+ $warned_extensions[ucfirst($extension_data["code"])] = $warning;
90
+ }
91
  }
92
  }
93
 
94
  if(!empty($warned_extensions)){
95
  if(count($warned_extensions) > 1){
96
  $text1 = array();
97
+ $text2 = array();
98
  if(count($warned_extensions) == 2){
99
  foreach($warned_extensions as $key => $value){
100
  $text1[] = $key;
101
  $text2[] = $key . " extension will be disabled in " . $value;
102
  }
103
+ $text1 = implode(" and ", $text1);
104
+ $text2 = implode(" and the ", $text2);
105
  }else{
106
  foreach($warned_extensions as $key => $value){
107
  $text1[] = $key;
108
  $text2[] = $key . " extension will be disabled in " . $value;
109
  }
110
  $last_element = array_pop($text1);
111
+ $text1 = implode(", ", $text1) . " and " . $last_element;
112
+ $last_element = array_pop($text2);
113
+ $text2 = implode(", the ", $text2) . " and the " . $last_element;
114
+ }
115
+
116
  $message = Mage::Helper("base")->__("Please insert the license key for the " . $text1 . " extensions. The " . $text2 . ".");
117
  }else{
118
  $text1 = min(array_keys($warned_extensions));
119
  $text2 = $warned_extensions[$text1];
120
  $message = Mage::Helper("base")->__("Please insert the license key for the " . $text1 . " extension. The extension will be disabled in " . $text2 . ".");
121
  }
122
+
123
  Mage::getSingleton('adminhtml/session')->addError($message);
124
  }
125
+
126
  if(!empty($disabled_extensions)){
127
  if(count($disabled_extensions) > 1){
128
  $text = "";
129
+ if(count($disabled_extensions) == 2){
130
  $text = implode(" and ", $disabled_extensions);
131
  }else{
132
  $last_element = array_pop($disabled_extensions);
133
+ $text = implode(", ", $disabled_extensions) . " and " . $last_element;
134
  }
135
  $message = Mage::Helper("base")->__("The " . $text . " extensions are disabled. Please insert the license key.");
136
  }else{
137
  $text = $disabled_extensions[0];
138
  $message = Mage::Helper("base")->__("The " . $text . " extension is disabled. Please insert the license key.");
139
+ }
140
+
141
  Mage::getSingleton('adminhtml/session')->addError($message);
142
  }
143
+
144
  return $this;
145
  }
146
 
149
  $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
150
  sort($modules);
151
  foreach($modules as $extension){
152
+ if($extension != "Ecomwise_Base" && strstr($extension, 'Ecomwise_') !== false){
153
+ $is_module_enable = Mage::helper('core')->isModuleEnabled($extension);
154
+ if($is_module_enable){
155
+ $extensionName = explode("_", $extension);
156
+ $ecomwise_extensions[$extension] = array("code" => strtolower($extensionName[1]), "current_output_status" => Mage::getStoreConfig('advanced/modules_disable_output/' . $extension));
157
+ }
158
  }
159
  }
160
+
161
+ $ecomwise_extensions = $this->excludeB2BSuiteExtensions($ecomwise_extensions);
162
+
163
+ return $ecomwise_extensions;
164
+ }
165
+
166
+ private function excludeB2BSuiteExtensions($ecomwise_extensions){
167
+ if(!empty($ecomwise_extensions) && array_key_exists("Ecomwise_B2BSuite", $ecomwise_extensions)){
168
+ if($ecomwise_extensions["Ecomwise_B2BSuite"]["current_output_status"] == "" || $ecomwise_extensions["Ecomwise_B2BSuite"]["current_output_status"] == "0"){
169
+ $extensions_part_of_b2b_suite = Mage::helper("b2bsuite")->getExtensionsPartOfB2BSuite();
170
+ if(is_array($extensions_part_of_b2b_suite) && !empty($extensions_part_of_b2b_suite)){
171
+ reset($ecomwise_extensions);
172
+ $first_key = key($ecomwise_extensions);
173
+ if($first_key != "Ecomwise_B2BSuite"){
174
+ $ecomwise_b2b_suite_extension = $ecomwise_extensions["Ecomwise_B2BSuite"];
175
+ unset($ecomwise_extensions["Ecomwise_B2BSuite"]);
176
+ $ecomwise_extensions = array_merge(array("Ecomwise_B2BSuite" => $ecomwise_b2b_suite_extension), $ecomwise_extensions);
177
+ }
178
+
179
+ foreach($ecomwise_extensions as $extension => $extension_data){
180
+ if(in_array($extension, $extensions_part_of_b2b_suite)){
181
+ unset($ecomwise_extensions[$extension]);
182
+ }
183
+ }
184
+ }
185
+ }
186
+ }
187
+
188
  return $ecomwise_extensions;
189
  }
190
 
195
 
196
  private function getServerResponse($extension, $domain, $license_number){
197
  $curl = new Varien_Http_Adapter_Curl();
198
+ $curl->setConfig(array('timeout' => 2));
 
 
199
 
200
  $ip_address = $this->getIpAddress();
201
  $base_version = Mage::getConfig()->getModuleConfig("Ecomwise_Base")->version;
202
+ $parametars = "extension/$extension/domain/$domain/ip_address/$ip_address/licence_number/$license_number/base_version/$base_version";
203
+
204
  $curl->write(Zend_Http_Client::GET, $this->getLicenserUrl() . $parametars, '1.0');
205
  $data = $curl->read();
206
  if ($data === false){
207
+ return array("code" => "503", "message" => "");
208
  }
209
+
210
  $data = preg_split('/^\r?$/m', $data, 2);
211
  $data = str_replace("\n", "", trim($data[1]));
212
  $curl->close();
219
  Mage::getConfig()->saveConfig('advanced/modules_disable_output/' . $extension, $response);
220
  return $this;
221
  }
222
+
223
  private function setExtensionStatus($extension, $response){
224
  $response = isset($response["code"]) && $response["code"] == "100" ? "disable" : "active";
225
  Mage::getConfig()->saveConfig($extension . '/status/valid', $response);
226
  return $this;
227
  }
228
+
229
  private function setExtensionWarning($extension, $response){
230
  $response = isset($response["code"]) && $response["code"] == "500" ? $response["message"] : "";
231
+ Mage::getConfig()->saveConfig($extension . '/status/warning', $response);
232
+ return $this;
233
  }
234
+
235
  private function getIpAddress(){
236
  return isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : "";
237
  }
app/code/community/Ecomwise/Base/Model/NotificationsNotifier/Observer.php CHANGED
File without changes
app/code/community/Ecomwise/Base/Model/NotificationsNotifier/Source/Updates/Type.php CHANGED
File without changes
app/code/community/Ecomwise/Base/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Ecomwise_Base>
5
- <version>1.0.1</version>
6
  </Ecomwise_Base>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Ecomwise_Base>
5
+ <version>1.0.2</version>
6
  </Ecomwise_Base>
7
  </modules>
8
  <global>
app/code/community/Ecomwise/Base/etc/system.xml CHANGED
File without changes
app/code/community/Ecomwise/Forcelogin/Block/Adminhtml/Support.php CHANGED
@@ -10,7 +10,7 @@ class Ecomwise_Forcelogin_Block_Adminhtml_Support extends Mage_Adminhtml_Block_A
10
  public $email = 'feedback@ecomwise.com';
11
  public $faq = 'http://support.ecomwise.com/support/solutions/folders/111251';
12
  public $name = 'B2B Forced Login';
13
- public $compatibility = 'Magento CE 1.7-1.9';
14
  public $manualUrl = 'http://support.ecomwise.com/support/solutions/articles/162497-forced-login-';
15
 
16
  public function render(Varien_Data_Form_Element_Abstract $element) {
10
  public $email = 'feedback@ecomwise.com';
11
  public $faq = 'http://support.ecomwise.com/support/solutions/folders/111251';
12
  public $name = 'B2B Forced Login';
13
+ public $compatibility = 'Magento CE 1.7-1.9.x';
14
  public $manualUrl = 'http://support.ecomwise.com/support/solutions/articles/162497-forced-login-';
15
 
16
  public function render(Varien_Data_Form_Element_Abstract $element) {
app/code/community/Ecomwise/Forcelogin/Block/System/Config/Version.php CHANGED
File without changes
app/code/community/Ecomwise/Forcelogin/Helper/Customer.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ecomwise_Forcelogin_Helper_Customer extends Mage_Customer_Helper_Data
4
+ {
5
+ public function isRegistrationAllowed()
6
+ {
7
+ $forceLoginEnabled = Mage::getStoreConfig('forcelogin/general/enabled');
8
+ $forceLoginValue = Mage::getStoreConfig('forcelogin/parameters_forcelogin/enabled');
9
+
10
+ if ($forceLoginValue == "0" && $forceLoginEnabled == "1") {
11
+ return false;
12
+ }
13
+ else {
14
+ $result = new Varien_Object(array('is_allowed' => true));
15
+ Mage::dispatchEvent('customer_registration_is_allowed', array('result' => $result));
16
+ return $result->getIsAllowed();
17
+ }
18
+ }
19
+ }
app/code/community/Ecomwise/Forcelogin/Helper/Data.php CHANGED
File without changes
app/code/community/Ecomwise/Forcelogin/Model/Config/Source/YesNo.php CHANGED
@@ -5,8 +5,8 @@ class Ecomwise_Forcelogin_Model_Config_Source_YesNo
5
  public function toOptionArray()
6
  {
7
  return array(
8
- array('value'=>'1', 'label'=>Mage::helper('adminhtml')->__('No')),
9
- array('value'=>'0', 'label'=>Mage::helper('adminhtml')->__('Yes')),
10
  );
11
  }
12
  }
5
  public function toOptionArray()
6
  {
7
  return array(
8
+ array('value'=>'1', 'label'=>Mage::helper('adminhtml')->__('Via Login and Register')),
9
+ array('value'=>'0', 'label'=>Mage::helper('adminhtml')->__('Via Login'))
10
  );
11
  }
12
  }
app/code/community/Ecomwise/Forcelogin/Model/Observer.php CHANGED
@@ -3,31 +3,53 @@ class Ecomwise_Forcelogin_Model_Observer extends Varien_Object{
3
 
4
  public function forceLogin($observer){
5
 
 
 
6
  $adminPath = Mage::getStoreConfig('admin/url/custom_path');
7
 
8
  $url = Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
9
  $adminUrl = $url->asArray();
10
 
11
-
12
- $forceLogin = (bool) Mage::getStoreConfig('forcelogin/parameters/enabled', Mage::app()->getStore());
13
- if(!$forceLogin){
14
- if ( ! Mage::getSingleton('customer/session')->isLoggedIn()
15
- && ! Mage::getSingleton('admin/session')->isLoggedIn()
16
- && Mage::app()->getRequest()->getModuleName() !== $adminUrl
17
- && Mage::app()->getRequest()->getModuleName() !== $adminPath
18
- && Mage::app()->getRequest()->getModuleName() !== 'api'
19
- && Mage::app()->getRequest()->getControllerName() !== 'account') {
20
- $session = Mage::getSingleton("customer/session");
21
-
22
- $session->setBeforeAuthUrl(Mage::helper('customer')->getLoginUrl());
23
-
24
- Mage::app()->getResponse()
25
- ->setRedirect(Mage::helper('adminhtml')
26
- ->getUrl("customer/account/login", array('_type' => 'direct_link')));
27
 
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  }
30
  }
31
-
32
  }
33
 
3
 
4
  public function forceLogin($observer){
5
 
6
+ if (Mage::getStoreConfig('forcelogin/general/enabled') == "1") {
7
+
8
  $adminPath = Mage::getStoreConfig('admin/url/custom_path');
9
 
10
  $url = Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
11
  $adminUrl = $url->asArray();
12
 
13
+ $forceLogin = Mage::getStoreConfig('forcelogin/parameters_forcelogin/enabled', Mage::app()->getStore());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
+ if(Mage::getSingleton('customer/session')->isLoggedIn()){
16
+ return $this;
17
+ }
18
+
19
+ if(Mage::getSingleton('admin/session')->isLoggedIn()){
20
+ return $this;
21
+ }
22
+
23
+ if(Mage::app()->getRequest()->getModuleName() === $adminUrl){
24
+ return $this;
25
+ }
26
+
27
+ if(Mage::app()->getRequest()->getModuleName() === $adminPath){
28
+ return $this;
29
+ }
30
+
31
+ if(Mage::app()->getRequest()->getModuleName() === 'api'){
32
+ return $this;
33
+ }
34
+
35
+ if(Mage::app()->getRequest()->getControllerName() === 'account' && $forceLogin === "1"){
36
+ return $this;
37
+ }
38
+
39
+ if($forceLogin === "0"
40
+ && Mage::app()->getRequest()->getControllerName() === 'account'
41
+ && (Mage::app()->getRequest()->getActionName() === 'login'|| Mage::app()->getRequest()->getActionName() === 'loginPost')
42
+ ){
43
+ return $this;
44
+ }
45
+
46
+ $session = Mage::getSingleton("customer/session");
47
+ $session->setBeforeAuthUrl(Mage::helper('customer')->getLoginUrl());
48
+ Mage::app()->getResponse()->setRedirect(Mage::getUrl('', array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure())). "customer/account/login");
49
+
50
+ return $this;
51
+
52
  }
53
  }
 
54
  }
55
 
app/code/community/Ecomwise/Forcelogin/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Ecomwise_Forcelogin>
5
- <version>1.0.5</version>
6
  </Ecomwise_Forcelogin>
7
 
8
  </modules>
@@ -23,6 +23,11 @@
23
  <forcelogin>
24
  <class>Ecomwise_Forcelogin_Helper</class>
25
  </forcelogin>
 
 
 
 
 
26
  </helpers>
27
 
28
  <events>
@@ -37,6 +42,15 @@
37
  </controller_action_postdispatch>
38
  </events>
39
  </global>
 
 
 
 
 
 
 
 
 
40
  <adminhtml>
41
  <acl>
42
  <resources>
@@ -63,9 +77,9 @@
63
  </adminhtml>
64
  <default>
65
  <forcelogin>
66
- <parameters>
67
- <enabled>1</enabled>
68
- </parameters>
69
  </forcelogin>
70
  </default>
71
  </config>
2
  <config>
3
  <modules>
4
  <Ecomwise_Forcelogin>
5
+ <version>1.1.3</version>
6
  </Ecomwise_Forcelogin>
7
 
8
  </modules>
23
  <forcelogin>
24
  <class>Ecomwise_Forcelogin_Helper</class>
25
  </forcelogin>
26
+ <customer>
27
+ <rewrite>
28
+ <data>Ecomwise_Forcelogin_Helper_Customer</data>
29
+ </rewrite>
30
+ </customer>
31
  </helpers>
32
 
33
  <events>
42
  </controller_action_postdispatch>
43
  </events>
44
  </global>
45
+ <frontend>
46
+ <layout>
47
+ <updates>
48
+ <forcelogin>
49
+ <file>forcelogin.xml</file>
50
+ </forcelogin>
51
+ </updates>
52
+ </layout>
53
+ </frontend>
54
  <adminhtml>
55
  <acl>
56
  <resources>
77
  </adminhtml>
78
  <default>
79
  <forcelogin>
80
+ <general>
81
+ <enabled>0</enabled>
82
+ </general>
83
  </forcelogin>
84
  </default>
85
  </config>
app/code/community/Ecomwise/Forcelogin/etc/system.xml CHANGED
@@ -7,7 +7,7 @@
7
  </ecomwise>
8
  </tabs>
9
  <sections>
10
- <forcelogin translate="label" module="forcelogin">
11
  <label>B2B Forced Login</label>
12
  <tab>ecomwise</tab>
13
  <frontend_type>text</frontend_type>
@@ -16,7 +16,7 @@
16
  <show_in_website>1</show_in_website>
17
  <show_in_store>1</show_in_store>
18
  <groups>
19
- <forcelogin translate="label">
20
  <label>Info &amp; Support</label>
21
  <frontend_type>text</frontend_type>
22
  <sort_order>1</sort_order>
@@ -34,9 +34,9 @@
34
  <show_in_store>1</show_in_store>
35
  </forcelogin_version>
36
  </fields>
37
- </forcelogin>
38
- <parameters translate="label">
39
- <label>Settings</label>
40
  <frontend_type>text</frontend_type>
41
  <sort_order>3</sort_order>
42
  <show_in_default>1</show_in_default>
@@ -44,7 +44,26 @@
44
  <show_in_store>1</show_in_store>
45
  <fields>
46
  <enabled translate="label">
47
- <label>Extension Enabled</label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  <frontend_type>select</frontend_type>
49
  <source_model>forcelogin/config_source_yesNo</source_model>
50
  <sort_order>10</sort_order>
@@ -53,7 +72,7 @@
53
  <show_in_store>1</show_in_store>
54
  </enabled>
55
  </fields>
56
- </parameters>
57
  </groups>
58
  </forcelogin>
59
  </sections>
7
  </ecomwise>
8
  </tabs>
9
  <sections>
10
+ <forcelogin translate="label" module="adminhtml">
11
  <label>B2B Forced Login</label>
12
  <tab>ecomwise</tab>
13
  <frontend_type>text</frontend_type>
16
  <show_in_website>1</show_in_website>
17
  <show_in_store>1</show_in_store>
18
  <groups>
19
+ <info translate="label">
20
  <label>Info &amp; Support</label>
21
  <frontend_type>text</frontend_type>
22
  <sort_order>1</sort_order>
34
  <show_in_store>1</show_in_store>
35
  </forcelogin_version>
36
  </fields>
37
+ </info>
38
+ <general translate="label">
39
+ <label>General</label>
40
  <frontend_type>text</frontend_type>
41
  <sort_order>3</sort_order>
42
  <show_in_default>1</show_in_default>
44
  <show_in_store>1</show_in_store>
45
  <fields>
46
  <enabled translate="label">
47
+ <label>Extension Enabled</label>
48
+ <frontend_type>select</frontend_type>
49
+ <source_model>adminhtml/system_config_source_yesno</source_model>
50
+ <sort_order>10</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ </enabled>
55
+ </fields>
56
+ </general>
57
+ <parameters_forcelogin translate="label">
58
+ <label>Forcelogin Settings</label>
59
+ <frontend_type>text</frontend_type>
60
+ <sort_order>4</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ <fields>
65
+ <enabled translate="label">
66
+ <label>Access to Website</label>
67
  <frontend_type>select</frontend_type>
68
  <source_model>forcelogin/config_source_yesNo</source_model>
69
  <sort_order>10</sort_order>
72
  <show_in_store>1</show_in_store>
73
  </enabled>
74
  </fields>
75
+ </parameters_forcelogin>
76
  </groups>
77
  </forcelogin>
78
  </sections>
app/design/adminhtml/default/default/template/forcelogin/support.phtml CHANGED
File without changes
app/design/frontend/base/default/layout/forcelogin.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addItem"><type>skin_css</type><name>forcelogin/css/style.css</name></action>
6
+ </reference>
7
+ </default>
8
+ </layout>
app/etc/modules/Ecomwise_Base.xml CHANGED
File without changes
app/etc/modules/Ecomwise_Forcelogin.xml CHANGED
File without changes
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ecomwise_Forcelogin</name>
4
- <version>1.0.5</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>1.0.5</notes>
12
  <authors><author><name>EcomwiseTeam</name><user>EcomwiseTeam</user><email>info@ecomwise.com</email></author></authors>
13
- <date>2015-09-04</date>
14
- <time>09:40:05</time>
15
- <contents><target name="magecommunity"><dir><dir name="Ecomwise"><dir name="Base"><dir name="Block"><dir name="NotificationsNotifier"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="Ecomwise"><file name="Extensions.php" hash="bd35aca3be511e975d9f52200b61793a"/></dir></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7b4c6e200a7c96d8b636057efad0cc1e"/></dir><dir name="Model"><dir name="ExtensionsLicencer"><file name="Observer.php" hash="e5ce78f2d1de491159194d5c26fa8338"/></dir><dir name="NotificationsNotifier"><file name="Observer.php" hash="d7717cc44d954eb771a26160ea6206ae"/><dir name="Source"><dir name="Updates"><file name="Type.php" hash="9dc2b16665b60c4334a5e9b75bbcd1fd"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="4233a2cbfb1c2b8a5de6ca8911955195"/><file name="system.xml" hash="89d092ed5df73b846826e6032d741885"/></dir></dir><dir name="Forcelogin"><dir name="Block"><dir name="Adminhtml"><file name="Support.php" hash="aa96e2681816d83867f21e88edc1cfa9"/></dir><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"><dir name="Config"><dir name="Source"><file name="YesNo.php" hash="5990e9ac771451b19a7f28b507773046"/></dir></dir><file name="Observer.php" hash="9b14386f9fa355a5e75e8bd5bc65ac52"/></dir><dir name="etc"><file name="config.xml" hash="4b855acfa07fee3eb460507cfcf2e455"/><file name="system.xml" hash="7e6a031fbabea65ad4de223ef576e3ea"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Ecomwise_Base.xml" hash=""/><file name="Ecomwise_Forcelogin.xml" hash=""/></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="forcelogin"><file name="support.phtml" hash="6f645f27af2e11ea2786f35c03b4791b"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="ecomwise"><file name="extensions_logo.png" hash="398cfc27d0a8fc693da176e102e7c013"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.0.0</min><max>5.9.9</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ecomwise_Forcelogin</name>
4
+ <version>1.1.3</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>1.1.3</notes>
12
  <authors><author><name>EcomwiseTeam</name><user>EcomwiseTeam</user><email>info@ecomwise.com</email></author></authors>
13
+ <date>2016-05-10</date>
14
+ <time>10:19:14</time>
15
+ <contents><target name="magecommunity"><dir><dir name="Ecomwise"><dir name="Base"><dir name="Block"><dir name="NotificationsNotifier"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="Ecomwise"><file name="Extensions.php" hash="bd35aca3be511e975d9f52200b61793a"/></dir></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7b4c6e200a7c96d8b636057efad0cc1e"/></dir><dir name="Model"><dir name="ExtensionsLicencer"><file name="Observer.php" hash="e5ce78f2d1de491159194d5c26fa8338"/></dir><dir name="NotificationsNotifier"><file name="Observer.php" hash="d7717cc44d954eb771a26160ea6206ae"/><dir name="Source"><dir name="Updates"><file name="Type.php" hash="9dc2b16665b60c4334a5e9b75bbcd1fd"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="4233a2cbfb1c2b8a5de6ca8911955195"/><file name="system.xml" hash="89d092ed5df73b846826e6032d741885"/></dir></dir><dir name="Forcelogin"><dir name="Block"><dir name="Adminhtml"><file name="Support.php" hash="aa96e2681816d83867f21e88edc1cfa9"/></dir><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"><dir name="Config"><dir name="Source"><file name="YesNo.php" hash="5990e9ac771451b19a7f28b507773046"/></dir></dir><file name="Observer.php" hash="9b14386f9fa355a5e75e8bd5bc65ac52"/></dir><dir name="etc"><file name="config.xml" hash="1c369220ccdb0770a99567aba7d5811e"/><file name="system.xml" hash="7e6a031fbabea65ad4de223ef576e3ea"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Ecomwise_Base.xml" hash=""/><file name="Ecomwise_Forcelogin.xml" hash=""/></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="forcelogin"><file name="support.phtml" hash="6f645f27af2e11ea2786f35c03b4791b"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="ecomwise"><file name="extensions_logo.png" hash="398cfc27d0a8fc693da176e102e7c013"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.0.0</min><max>5.9.9</max></php></required></dependencies>
18
  </package>
skin/adminhtml/default/default/images/ecomwise/extensions_logo.png CHANGED
File without changes
skin/frontend/base/default/forcelogin/css/style.css ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ .customer-account-login .account-login.login-only .col-1.registered-users ul{
2
+ list-style: outside none none;
3
+ margin: 0;
4
+ padding: 0;
5
+ }
6
+ .customer-account-login .account-login.login-only .col-1.registered-users{
7
+ width:50%;
8
+ }