- fixed password length validation;

- added settings for the password min/max length;
This commit is contained in:
Nikita Sinelnikov
2021-09-21 13:25:49 +03:00
parent 5394305340
commit e8c1497ec4
7 changed files with 45 additions and 11 deletions
+7 -2
View File
@@ -543,11 +543,16 @@ if ( ! class_exists( 'um\core\Password' ) ) {
if ( UM()->options()->get( 'reset_require_strongpass' ) ) {
if ( strlen( utf8_decode( $args['user_password'] ) ) < 8 ) {
$min_length = UM()->options()->get( 'password_min_chars' );
$min_length = ! empty( $min_length ) ? $min_length : 8;
$max_length = UM()->options()->get( 'password_max_chars' );
$max_length = ! empty( $max_length ) ? $max_length : 30;
if ( mb_strlen( $args['user_password'] ) < $min_length ) {
UM()->form()->add_error( 'user_password', __( 'Your password must contain at least 8 characters', 'ultimate-member' ) );
}
if ( strlen( utf8_decode( $args['user_password'] ) ) > 30 ) {
if ( mb_strlen( $args['user_password'] ) > $max_length ) {
UM()->form()->add_error( 'user_password', __( 'Your password must contain less than 30 characters', 'ultimate-member' ) );
}