| @@ 92-123 (lines=32) @@ | ||
| 89 | * |
|
| 90 | * @param Mixed $user can be an integer ID, or a WP_User object. |
|
| 91 | */ |
|
| 92 | public function __construct( $user = null ) { |
|
| 93 | ||
| 94 | /** |
|
| 95 | * Filters Jetpack's password strength enforcement settings. You can supply your own passwords |
|
| 96 | * that should not be used for authenticating in addition to weak and easy to guess strings for |
|
| 97 | * each user. For example, you can add passwords from known password databases to avoid compromised |
|
| 98 | * password usage. |
|
| 99 | * |
|
| 100 | * @since 7.2.0 |
|
| 101 | * |
|
| 102 | * @param array $restricted_passwords strings that are forbidden for use as passwords. |
|
| 103 | */ |
|
| 104 | $this->common_passwords = apply_filters( 'jetpack_password_checker_restricted_strings', array() ); |
|
| 105 | ||
| 106 | if ( is_null( $user ) ) { |
|
| 107 | $this->user_id = get_current_user_id(); |
|
| 108 | } elseif ( is_object( $user ) && isset( $user->ID ) ) { |
|
| 109 | ||
| 110 | // Existing user, using their ID. |
|
| 111 | $this->user_id = $user->ID; |
|
| 112 | ||
| 113 | } elseif ( is_object( $user ) ) { |
|
| 114 | ||
| 115 | // Newly created user, using existing data. |
|
| 116 | $this->user = $user; |
|
| 117 | $this->user_id = 'new_user'; |
|
| 118 | ||
| 119 | } else { |
|
| 120 | $this->user_id = $user; |
|
| 121 | } |
|
| 122 | $this->min_password_length = apply_filters( 'better_password_min_length', $this->min_password_length ); |
|
| 123 | } |
|
| 124 | ||
| 125 | /** |
|
| 126 | * Run tests against a password. |
|
| @@ 90-121 (lines=32) @@ | ||
| 87 | * |
|
| 88 | * @param Mixed $user can be an integer ID, or a WP_User object. |
|
| 89 | */ |
|
| 90 | public function __construct( $user = null ) { |
|
| 91 | ||
| 92 | /** |
|
| 93 | * Filters Jetpack's password strength enforcement settings. You can supply your own passwords |
|
| 94 | * that should not be used for authenticating in addition to weak and easy to guess strings for |
|
| 95 | * each user. For example, you can add passwords from known password databases to avoid compromised |
|
| 96 | * password usage. |
|
| 97 | * |
|
| 98 | * @since 7.2.0 |
|
| 99 | * |
|
| 100 | * @param array $restricted_passwords strings that are forbidden for use as passwords. |
|
| 101 | */ |
|
| 102 | $this->common_passwords = apply_filters( 'jetpack_password_checker_restricted_strings', array() ); |
|
| 103 | ||
| 104 | if ( is_null( $user ) ) { |
|
| 105 | $this->user_id = get_current_user_id(); |
|
| 106 | } elseif ( is_object( $user ) && isset( $user->ID ) ) { |
|
| 107 | ||
| 108 | // Existing user, using their ID. |
|
| 109 | $this->user_id = $user->ID; |
|
| 110 | ||
| 111 | } elseif ( is_object( $user ) ) { |
|
| 112 | ||
| 113 | // Newly created user, using existing data. |
|
| 114 | $this->user = $user; |
|
| 115 | $this->user_id = 'new_user'; |
|
| 116 | ||
| 117 | } else { |
|
| 118 | $this->user_id = $user; |
|
| 119 | } |
|
| 120 | $this->min_password_length = apply_filters( 'better_password_min_length', $this->min_password_length ); |
|
| 121 | } |
|
| 122 | ||
| 123 | /** |
|
| 124 | * Run tests against a password. |
|