WP Manifestindependent plugin directory
manifest / security / two-factor-enforced

Two-Factor Enforced

WordPress Plugin that enables Two-Factor Authentication for all newly registered users

★ 0stars
1.2.0latest · 1 year ago

Install

Download two-factor-enforced.zip From the 1.2.0 release on GitHub, Dec 31, 2024

Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/timnashcouk/two-factor-enforced/releases/download/1.2.0/two-factor-enforced.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

A WordPress plugin that extends, the WordPress plugin Two-Factor to automatically enable Two-Factor for newly registered users.

Requirements

  • PHP 8.1+
  • WordPress 6.7+
  • Two-Factor 0.10.0+

    Installation

Manual Installation

Download the plugin ZIP file from this repository.

  1. Upload the ZIP file via the Plugins > Add New > Upload Plugin section of your WordPress dashboard.
  2. Activate the plugin from the Plugins menu.

WP-CLI Installation

Run the following via WP-CLI

wp cli plugin install https://github.com/timnashcouk/two-factor-enforced/releases/latest/two-factor-enforced.zip --activate 

Usage/Examples

Once activated, the plugin will set all newly registered users to use the default Two-Factor Email Provider which uses the email they registered with.

Enabling for specific roles

If you wish to only have specifical roles such as administrator enforced then this can be set:

  • Through a define
  • Through a filter

Defining roles

Within wp-config.php or similar config adding the following:

define( 'TWO_FACTOR_ENFORCED_ROLES', [ 'administrator' ] );

This will limit the enforcement to just admin users

Using a filter

The following can be used to filter the roles

    return ['administrator'];
});

Changing Default Provider

By default the plugin will enable email as the default provider for a user. This can be changed via filters.

[!NOTE] You need to change BOTH filters adding the new provider as the Primary and adding it into the list enabled for users.

add_filter('two_factor_enforced_default_providers', function (array $default_providers, int $user_id): array { return ['Two_Factor_Email', 'Two_Factor_Debug']; }, 10, 2); 

and

php add_filter('two_factor_enforced_primary_provider', function (string $default_primary_provider, int $user_id): string { return 'Two_Factor_Debug'; }, 10, 2); 

Support

Issues with code please do open a Github Issue. The plugin is supplied as is with no formal support.

Changelog

See CHANGELOG.md for notable changes per version.

Releases

1 release. Each count is every asset in that release; expand a row for the breakdown.

Tag
Published
Assets
Downloads
1.2.0 latest
Dec 31, 2024 1 year ago
two-factor-enforced.zip
0