| @@ 104-119 (lines=16) @@ | ||
| 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 | ||
| @@ 85-100 (lines=16) @@ | ||
| 82 | * @param mixed $user can be an integer ID, or a WP_User object. |
|
| 83 | */ |
|
| 84 | public function __construct( $user = null ) { |
|
| 85 | if ( is_null( $user ) ) { |
|
| 86 | $this->user_id = get_current_user_id(); |
|
| 87 | } elseif ( is_object( $user ) && isset( $user->ID ) ) { |
|
| 88 | // Existing user, using their ID. |
|
| 89 | $this->user_id = $user->ID; |
|
| 90 | } elseif ( is_object( $user ) ) { |
|
| 91 | // Newly created user, using existing data. |
|
| 92 | $this->user = $user; |
|
| 93 | $this->user_id = 'new_user'; |
|
| 94 | } else { |
|
| 95 | $this->user_id = $user; |
|
| 96 | } |
|
| 97 | ||
| 98 | /** |
|
| 99 | * Filters the password strength enforcement settings. |
|
| 100 | * |
|
| 101 | * You can supply your own passwords that should not be used for authenticating in addition to weak and easy |
|
| 102 | * to guess strings for each user. For example, you can add passwords from known password databases to avoid |
|
| 103 | * compromised password usage. |
|