2017 © Pedro Peláez
 

magento2-module magento2-force-customer-login

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

image

bitexpert/magento2-force-customer-login

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  • Saturday, July 7, 2018
  • by shochdoerfer
  • Repository
  • 9 Watchers
  • 82 Stars
  • 9,965 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 25 Forks
  • 3 Open issues
  • 41 Versions
  • 12 % Grown

The README.md

Force Login Module for Magento® 2

Build Status Coverage Status Mastodon Follow, (*1)

The Force Login Module for Magento® 2 allows you to restrict which pages a visitor is able to see. Visitors get redirected to the login page if the page is not marked visitable. The Force Login Module for Magento® 2 is especially useful for merchants serving only a specific group of users, e.g. enterprise related business partners and need to ensure that only those users are able to browse the the website or the product catalog., (*2)

Features:

  • Force your guest visitors to log in first (or register), before allowing them to visit your pages and catalog
  • Administration: Manage the whitelist rules by the GUI in the administration area
  • ACL: Restrict the administration of whitelist rules to certain backend user groups
  • Whitelisting: Define url rules as pattern to define which pages guest visitors can visit without logging in first
  • Multistore-Support: Define if whitelist rules either apply globally or for specific stores
  • Hyvä Themes compatible

Requirements:

  • PHP 7.4 or PHP 8.1
  • Magento 2.4.0 or higher

Installation

The preferred way of installing bitexpert/magento2-force-customer-login is through Composer. Simply add bitexpert/magento2-force-customer-login as a dependency:, (*3)

composer.phar require bitexpert/magento2-force-customer-login

Optional you can download the latest version here and install the decompressed code in your projects directory under app/code/BitExpert/ForceCustomerLogin., (*4)

Composer error package bitexpert/magento2-force-customer-login exists

When you have errors after installing trough composer there is probably an issue with version numbers between Packagist and Magento repo. You can update your project composer file to fix this:, (*5)

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://repo.magento.com/",
      "canonical": false
    }
  ]
}

Post-Install

After the installment of the module source code, the module has to be enabled by the Magento® 2 CLI., (*6)

bin/magento module:enable BitExpert_ForceCustomerLogin

System Upgrade

After enabling the module, the Magento® 2 system must be upgraded., (*7)

If the system mode is set to production, run the compile command first. This is not necessary for the developer mode., (*8)

bin/magento setup:di:compile

To upgrade the system, the upgrade command must be run., (*9)

bin/magento setup:upgrade

Clear Cache

At last, the Magento® 2 should be cleared by running the flush command., (*10)

bin/magento cache:flush

Sometimes, other cache systems or services must be restarted first, e.g. Apache Webserver and PHP FPM., (*11)

User Guide

Find the complete user guide here., (*12)

How to use

The usage of the Force Login Module for Magento® 2 is applied implicitly by redirecting visitors if the called URI does not match any configured whitelisted url rules., (*13)

Whitelisting

Whitelisting is based upon the usage of rules. The strategy selection defines how the rules are interpreted, details are listed below. By default, some static rules are already listed. The following example shows, how to add a whitelist entry for the homepage (startpage)., (*14)

Navigate to the Overview Grid and use the Add Entry button., (*15)

  • Enter Homepage into the text field beside from the Label label.
  • Enter ^/?$ into the text field beside from the Url Rule label.
  • Select All Stores from the selection field beside from the Store label.

Use the Save button in the upper menu. After being redirected to the Overview Grid, the new entry should appear to the list and the systems homepage should be available for guest visitors., (*16)

How to configure

Administration

The Force Login Module for Magento® 2 allows you to enable or disable the module itself on the level of websites, stores and store views., (*17)

If the module is disabled, the whitelist ruling and the redirection are not applied. If the module is enabled based upon the configuration, the whitelist rules are process, which themselves are also configurable for all enabled stores or just specific ones., (*18)

After installing and enabling Force Login Module for Magento® 2 with the CLI, you must be able to navigate to Stores > Configuration > Force Login, where you are able to configure the availability of the module for each website, store and store view., (*19)

In the administration configuration, you are also able to setup the URL the redirecting is targeting to if not whitelist rule is matching., (*20)

alt text, (*21)

Navigating through the Magento® 2 backend menu by clicking onto Customers you must see a new menu entry Forced Login Whitelist., (*22)

Enter this menu entry., (*23)

alt text, (*24)

Overview Grid

You can add new entries by clicking on the Add Entry button in the upper right corner ( 1 ), see below. The grid ( 2 ) contains all existing whitelisted Url Rules, for which the forced redirect to the Customer Login Page is omitted. The Url Rules ( 3 ) are part of a regular expression checking on the called Url and tries to match against the whitelist. Url Rules may be related to all stores or to a specific one ( 4 ). All rules except some mandatory ones are editable ( 5 ) and removeable ( 6 )., (*25)

alt text, (*26)

Detail Form

You can return to the Overview Grid by using the Back button ( 1 ). The Label value has only declarative character and is for information purpose only ( 2 ). The Url Rule is an expression checking on the called Url and tries to match against the whitelist ( 3 ). Url Rules may be related to all stores or to a specific one ( 4 ). The strategy selection ( 5 ) defines how the Url Rule is interpreted, details are listed below. Persist the rule by using the Save button ( 6 )., (*27)

alt text, (*28)

Strategies

Static

Rule is used as a literal value and will be added onto the base url for matching. This is default behaviour., (*29)

RegEx-All

Rule is based on regular expression, and will be used for looking up matching anywhere in the current Url., (*30)

RegEx-All Negation

Based on the RegEx-All strategy, but negates the result. Helpful if only a few pages should be restricted., (*31)

Tests

You can run the unit tests with the following command (requires dependency installation):, (*32)

composer test

Contribution

Feel free to contribute to this module by reporting issues or create some pull requests for improvements., (*33)

License

The Force Login Module for Magento® 2 is released under the Apache 2.0 license., (*34)

The Versions

07/07 2018

dev-master

9999999-dev

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.5|7.0.2|7.0.4|~7.0.6|~7.1.0
  • magento/module-customer ~100.1|~101.0

 

The Development Requires

26/12 2017

dev-release/r3.0.0

dev-release/r3.0.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.5|7.0.2|7.0.4|~7.0.6|~7.1.0
  • magento/module-customer ~100.1|~101.0

 

The Development Requires

26/12 2017

3.0.1

3.0.1.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.5|7.0.2|7.0.4|~7.0.6|~7.1.0
  • magento/module-customer ~100.1|~101.0

 

The Development Requires

25/12 2017

v3.0.0

3.0.0.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • magento/module-customer ~101.0

 

The Development Requires

31/10 2017

dev-release/r2.3.0

dev-release/r2.3.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • magento/module-customer ~101.0

 

The Development Requires

31/10 2017

2.3.0

2.3.0.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • magento/module-customer ~101.0

 

The Development Requires

26/10 2017

2.3.0-RC2

2.3.0.0-RC2

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • magento/module-customer ~101.0

 

The Development Requires

26/10 2017

dev-fix/91_admin_block

dev-fix/91_admin_block

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • magento/module-customer ~101.0

 

The Development Requires

25/10 2017

2.3.0-RC1

2.3.0.0-RC1

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • magento/module-customer ~101.0

 

The Development Requires

04/10 2017

dev-release/r2.2.0

dev-release/r2.2.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • magento/module-customer ~101.0

 

The Development Requires

04/10 2017

2.2.0

2.2.0.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~7.0|~7.1
  • magento/module-customer ~101.0

 

The Development Requires

04/08 2017

dev-release/r2.1.0

dev-release/r2.1.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

04/08 2017

2.1.0

2.1.0.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

03/08 2017

2.1.0-RC4

2.1.0.0-RC4

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

11/07 2017

2.1.0-RC3

2.1.0.0-RC3

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

05/07 2017

2.1.0-RC2

2.1.0.0-RC2

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

12/06 2017

dev-release/r2.0.0

dev-release/r2.0.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

12/06 2017

2.0.2

2.0.2.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

24/04 2017

2.0.1

2.0.1.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

19/04 2017

2.0.0

2.0.0.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

15/04 2017

2.0.0-RC3

2.0.0.0-RC3

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

10/04 2017

2.0.0-RC2

2.0.0.0-RC2

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

23/03 2017

2.0.0-RC1

2.0.0.0-RC1

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

11/03 2017

dev-release/r1.3.0

dev-release/r1.3.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

18/02 2017

1.3.1

1.3.1.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

17/02 2017

1.3.0

1.3.0.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer ~100.0

 

The Development Requires

29/09 2016

1.2.4

1.2.4.0

The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.1.*

 

The Development Requires

29/09 2016

1.1.7

1.1.7.0

The Force Frontend Customer Login Module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.0.*

 

The Development Requires

18/08 2016

1.2.3

1.2.3.0

The Force Frontend Customer Login Module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.1.*

 

The Development Requires

18/08 2016

1.1.6

1.1.6.0

The Force Frontend Customer Login Module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.0.*

 

The Development Requires

25/07 2016

1.2.2

1.2.2.0

Magento2 Module to force the login for frontend customers.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.1.*

 

The Development Requires

25/07 2016

1.1.5

1.1.5.0

Magento2 Module to force the login for frontend customers.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.0.*

 

The Development Requires

23/07 2016

1.1.4

1.1.4.0

Magento2 Module to force the login for frontend customers.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.0.*

 

The Development Requires

23/07 2016

1.2.1

1.2.1.0

Magento2 Module to force the login for frontend customers.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.1.*

 

The Development Requires

01/07 2016

1.2.0

1.2.0.0

Magento2 Module to force the login for frontend customers.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.1.*

 

The Development Requires

03/06 2016

1.1.3

1.1.3.0

Magento2 Module to force the login for frontend customers.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.0.*

 

The Development Requires

12/05 2016

1.1.2

1.1.2.0

Magento2 Module to force the login for frontend customers.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.0.*

 

The Development Requires

10/05 2016

1.1.1

1.1.1.0

Magento2 Module to force the login for frontend customers.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.0.*

 

The Development Requires

09/05 2016

1.1.0

1.1.0.0

Magento2 Module to force the login for frontend customers.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.0.*

 

The Development Requires

26/04 2016

1.0.1

1.0.1.0

Magento2 Module to force the login for frontend customers.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.0.*

 

The Development Requires

19/04 2016

1.0.0

1.0.0.0

Magento2 Module to force the login for frontend customers.

  Sources   Download

Apache-2.0

The Requires

  • php ~5.5.0|~5.6.0|~7.0.0
  • magento/module-customer 100.0.*

 

The Development Requires