| @@ -25,8 +25,22 @@ | ||
| 25 | 25 | if ( empty( $hostinger_plugin_settings['bypass_code'] ) ) { |
| 26 | 26 | $hostinger_plugin_settings['bypass_code'] = Helper::generate_bypass_code( 16 ); |
| 27 | 27 | $this->update_plugin_settings( $hostinger_plugin_settings ); |
| 28 | 28 | } |
| 29 | + | |
| 30 | + $this->configure_authentication_password(); | |
| 31 | + } | |
| 32 | + | |
| 33 | + public function configure_authentication_password(): void { | |
| 34 | + global $wpdb; | |
| 35 | + $hostinger_plugin_settings = get_option( HOSTINGER_PLUGIN_SETTINGS_OPTION, array() ); | |
| 36 | + | |
| 37 | + $existing_passwords = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->usermeta} WHERE meta_key = %s", '_application_passwords' ) ); | |
| 38 | + | |
| 39 | + if ( $existing_passwords === 0 ) { | |
| 40 | + $hostinger_plugin_settings['disable_authentication_password'] = true; | |
| 41 | + $this->update_plugin_settings( $hostinger_plugin_settings ); | |
| 42 | + } | |
| 29 | 43 | } |
| 30 | 44 | |
| 31 | 45 | private function update_plugin_settings( array $settings ): void { |
| 32 | 46 | $plugin_options = new PluginOptions( $settings ); |