Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/code/community/Sitewards/B2BProfessional/Helper/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class Sitewards_B2BProfessional_Helper_Customer extends Sitewards_B2BProfessiona
*/
const CONFIG_EXTENSION_REQUIRES_LOGIN = 'b2bprofessional/requirelogin/requirelogin';

/**
* Path for the config for extension allowed ip addresses that don't need to login
*/
//const CONFIG_EXTENSION_REQUIRES_LOGIN_IPADDRESSES = 'b2bprofessional/exemptips/ipaddresses';

/**
* Path for the config for extension is active by customer group
*/
Expand Down Expand Up @@ -157,7 +162,17 @@ public function isCustomerGroupActive()
*/
public function isLoginRequired()
{
//added by Philip pd@dwdonline.com DWD
$allowedIPAddresses = Mage::getStoreConfig('b2bprofessional/exemptips/ipaddresses');
$ip = $_SERVER['REMOTE_ADDR'];
$allowed = explode(",",$allowedIPAddresses);

if (in_array($ip, $allowed)) {
return $this->getStoreFlag('0', 'bLoginRequired');
} else {
return $this->getStoreFlag(self::CONFIG_EXTENSION_REQUIRES_LOGIN, 'bLoginRequired');
}
//end added by Philip pd@dwdonline.com DWD
}

/**
Expand Down
19 changes: 19 additions & 0 deletions app/code/community/Sitewards/B2BProfessional/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,25 @@
</requireloginredirect>
</fields>
</requirelogin>
<exemptips>
<label>Exempt IP Addresses for Login</label>
<frontend_type>text</frontend_type>
<sort_order>3</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<ipaddresses translate="label comment">
<label>Allowed IP's</label>
<frontend_type>text</frontend_type>
<sort_order>3</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment><![CDATA[List of IP Addresses seperated by comma. ie: 8.8.4.4,4.4.4.4]]></comment>
</ipaddresses>
</fields>
</exemptips>
<activatebycategorysettings translate="label comment">
<label>Activate by category</label>
<frontend_type>text</frontend_type>
Expand Down