diff --git a/providers/class-two-factor-email.php b/providers/class-two-factor-email.php index a3d86b43..3122ea1b 100644 --- a/providers/class-two-factor-email.php +++ b/providers/class-two-factor-email.php @@ -72,7 +72,7 @@ public function get_alternative_provider_label() { * @return string */ public function generate_token( $user_id ) { - $token_length = (int) apply_filters( 'two_factor_token_length', 8 ); + $token_length = (int) apply_filters( 'two_factor_email_token_length', 8 ); $token = $this->get_code( $token_length ); diff --git a/readme.txt b/readme.txt index d0853539..d72c194d 100644 --- a/readme.txt +++ b/readme.txt @@ -28,7 +28,7 @@ Here is a list of action and filter hooks provided by the plugin: - `two_factor_enabled_providers_for_user` filter overrides the list of two-factor providers enabled for a user. First argument is an array of enabled provider classnames as values, the second argument is the user ID. - `two_factor_user_authenticated` action which receives the logged in `WP_User` object as the first argument for determining the logged in user right after the authentication workflow. - `two_factor_token_ttl` filter overrides the time interval in seconds that an email token is considered after generation. Accepts the time in seconds as the first argument and the ID of the `WP_User` object being authenticated. -- `two_factor_token_length` filter overrides the default 8 character count for email tokens. +- `two_factor_email_token_length` filter overrides the default 8 character count for email tokens. - `two_factor_backup_code_length` filter overrides the default 8 character count for backup codes. Providers the `WP_User` of the associated user as the second argument. == Frequently Asked Questions == diff --git a/tests/providers/class-two-factor-email.php b/tests/providers/class-two-factor-email.php index 0b5a154c..6b10bcf6 100644 --- a/tests/providers/class-two-factor-email.php +++ b/tests/providers/class-two-factor-email.php @@ -358,7 +358,7 @@ public function test_custom_token_length() { $default_token = $this->provider->generate_token( $user_id ); add_filter( - 'two_factor_token_length', + 'two_factor_email_token_length', function() { return 15; } @@ -369,7 +369,7 @@ function() { $this->assertNotEquals( strlen( $default_token ), strlen( $custom_token ), 'Token length is different due to filter' ); $this->assertEquals( 15, strlen( $custom_token ), 'Token length matches the filter value' ); - remove_all_filters( 'two_factor_token_length' ); + remove_all_filters( 'two_factor_email_token_length' ); } }