Skip to content

The DisableTwoFactorAuth module provides the ability to disable two-factor authentication.

License

Notifications You must be signed in to change notification settings

artemii-karkusha/magento2-module-disabletwofactorauth

 
 

Repository files navigation

MarkShust_DisableTwoFactorAuth

Provides the ability to disable two-factor authentication.

Supported Magento Versions Latest Stable Version Composer Downloads Maintained - Yes

Table of contents

Summary

With the release of Magento 2.4, two-factor authentication (also known as 2FA) became enabled by default, with no ability to disable it in either the admin or console. However, there are situations which may require 2FA to be disabled or temporarily turned off, such as within development or testing environments.

This module adds the missing toggle to turn 2FA on or off from the admin. It does this by hooking into the core code in a very seamless manner, just as would be done if this toggle existed in the core code. Installing this module should not open up any security holes, as it just works off of a simple config toggle which if not present, falls back to default functionality.

Demo two-factor-auth-for-admin

Installation

composer require markshust/magento2-module-disabletwofactorauth
bin/magento module:enable MarkShust_DisableTwoFactorAuth
bin/magento setup:upgrade

Usage

This module keeps 2FA enabled by default. This is to prevent any unexpected side effects or security loopholes from being introduced during automated installation processes.

Disable 2FA

Enables the bypass of 2FA for admin access. This can be useful within development & integration environments.

Visit Admin > Stores > Settings > Configuration > Security > 2FA and set Enable 2FA to No.

CLI: bin/magento config:set twofactorauth/general/enable 0

NOTE: Always keep 2FA enabled within production environments for security purposes.

Disable 2FA for API Token Generation

Enables the bypass of 2FA for API token generation. This can be useful for third-party vendors during module development.

Visit Admin > Stores > Settings > Configuration > Security > 2FA and set Enable 2FA for API Token Generation to No.

CLI: bin/magento config:set twofactorauth/general/enable_for_api_token_generation 0

NOTE: Always keep 2FA enabled within production environments for security purposes.

Change 2FA for user (admin)

Enables the bypass of 2FA for admin access. We have to disable 2FA for this user.

If you want disable 2FA for user

Visit **Admin > System > Permissions > All Users > Pick user -> 2FA ** and set Enable 2FA to No. CLI: bin/magento admin:user:2fa:disable <username>

If you want enable 2FA for user

Visit **Admin > System > Permissions > All Users > Pick user -> 2FA ** and set Enable 2FA to Yes. CLI: bin/magento admin:user:2fa:enable <username>

NOTE:

If 2FA is enabled for user, and it is disabled for website, always returns true, so all requests bypass 2FA.
If 2FA is disabled for user, and it is enabled for website, always returns true, so all requests bypass 2FA.
If 2FA is disabled for user, and it is disabled for website, always returns true, so all requests bypass 2FA.
If 2FA is enabled for user, and it is enabled for website, returns the original result.

License

MIT

About

The DisableTwoFactorAuth module provides the ability to disable two-factor authentication.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%