Magento 2 Force Login extension requires customers to log in to view specific pages on your website, which are freely set up by you. When they are redirected to the login page, an alert message will be shown. After successful login, you can redirect customers to your chosen pages.
2. How Does It Work?
Please go to Store ⇒ Configuration ⇒ BSSCommerce ⇒ Force Login
2.1 General configs
In Enable: choose Yes to enable the Force Login functions.
In Disable Registration: choose Yes to disable the Registration link on the top link and login page, or No to enable it for the customer to sign up.
2.2 Enable "Force Login" When users visit pages
In Alert Message: edit a Magento 2 force login message to be shown on the restricted page.
There are 2 options to force login: All Page or Special Page.
For the Special Page option, you can choose to restrict access for two types of pages:
- Specific pages of your preference: Please enter your targeted URLs either as Exactly or Contain.
- Our suggested pages: Select types of page to force login to access:
- Specific Pages could be custom pages created by third-party extensions, for example, the FAQs.
2.3 Redirect users after successful login
It is important to streamline the experience of users after the "force-login" requirement. You can choose among 4 redirect options.
- Default: redirect users to the page after login like default Magento 2
- Home Page: redirect users to Home Page after login
- Previous Url: redirect users to the page they are trying to access when they are forced to login
- Custom Url: Enter the page URL that you want to send your customers to after login
- With custom pages by third-party extensions, if you select this option, you will be redirected to the previous page of the force login page.
For example: You require a login to access the FAQs page.
A customer goes to the Home page ⇒ Women (category page) ⇒ FAQs page and login. He/She is redirected to Women (category page).
- Remember to Save Config on completing
2.4 Google reCAPTCHA & 2FA installation
Magento is adding Google reCAPTCHA and 2FA functionality to all Magento Commerce and Open Source versions 2.1 and above to reduce unauthorized access and spam.
- Google reCAPTCHA technology is to ensure the access attempt by humans only, not bots. Compared with Magento CAPTCHA module, the reCAPTCHA enhances security with additional benefits including support for invisible reCAPTCHA.
- 2FA Authentication adds support for software authentication apps and hardware authentication devices provided by Google Authenticator, Authy, U2F devices, and Duo Security, among others.
Hence, BSS Commerce strongly recommends installing these functions for your Magento 2 Website.
Please go to the Magento 2 Dev Document for more information.