matcher = $matcher; } public function is_password_change_required( \WP_User $user, array $settings ): bool { $target = User_Groups\Match_Target::for_user( $user ); if ( ! $this->matcher->matches( $target, $settings['group'] ) ) { return false; } $days = isset( $settings['expire_max'] ) ? absint( $settings['expire_max'] ) : 120; $period = $days * DAY_IN_SECONDS; $oldest_allowed = ITSEC_Core::get_current_time_gmt() - $period; return ITSEC_Lib_Password_Requirements::password_last_changed( $user ) < $oldest_allowed; } public function evaluate( string $password, $user ) { return new \WP_Error( 'not_implemented', __( 'This password requirement does not evaluate passwords.' ) ); } public function validate( $evaluation, $user, array $settings, array $args ) { return true; } public function get_reason_message( $evaluation, array $settings ): string { $period = absint( $settings['expire_max'] ?? 120 ); return sprintf( esc_html__( 'Your password has expired. You must create a new password every %d days.', 'it-l10n-ithemes-security-pro' ), $period ); } public function is_always_enabled(): bool { return false; } public function should_evaluate_if_not_enabled(): bool { return false; } public function render( \ITSEC_Form $form ) { ?> add_user_groups( 'group', 'password-requirements', 'requirement_settings.age.group' ); ?>

add_text( 'expire_max', array( 'class' => 'small-text code' ) ); ?>