Last active
September 27, 2023 00:57
-
-
Save ipokkel/edf37381f0f67b5184bafb63ec320554 to your computer and use it in GitHub Desktop.
Change PMPro Strong Password's minimum required password strength.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * This recipe sets the required password strength for PMPro Strong Passwords. | |
| * | |
| * 1 is somewhat guessable (guesses < 10^8), provides some protection from unthrottled online attacks | |
| * 2 is safely unguessable (guesses < 10^10), offers moderate protection from offline slow-hash scenario | |
| * 3 is very unguessable (guesses >= 10^10) and provides strong protection from offline slow-hash scenario | |
| * | |
| * Default strength is 2. | |
| */ | |
| function my_pmprosp_minimum_password_score( $min_strength, $password_strength ) { | |
| // Set password strenght between 1 and 3 | |
| $min_strength = 3; | |
| // reset to default strength if out of range/ | |
| if ( $min_strength < 1 || $min_strength > 3 ) { | |
| $min_strength = 2; | |
| } | |
| return $min_strength; | |
| } | |
| add_filter( 'pmprosp_minimum_password_score', 'my_pmprosp_minimum_password_score', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment