PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
← All changes | src/component/two-factor/providers/class-totp.php +6 -6 5.6.2 → 6.3.0 View file →
@@ -281,9 +281,9 @@
281 281 * Generate a QR code for apps can use. Apps from get_auth_apps().
282 282 *
283 283 * @param string $secret_key The secret key for the TOTP.
284 284 *
285 - * @retun string
285 + * @return string
286 286 */
287 287 public static function generate_qr_code( $secret_key ) {
288 288 $settings = new Two_Fa();
289 289 $issuer = rawurlencode( $settings->app_title );
@@ -313,14 +313,14 @@
313 313 * @throws SodiumException Exceptions thrown by the sodium functions.
314 314 */
315 315 public function validate_authentication( WP_User $user ) {
316 316 $otp = HTTP::post( 'otp' );
317 - if ( empty( $otp ) ) {
317 + if ( ! is_string( $otp ) || '' === $otp ) {
318 318 $lockout_message = $this->get_component()->verify_attempt( $user->ID, self::$slug );
319 319
320 320 return new WP_Error(
321 321 'opt_fail',
322 - empty( $lockout_message )
322 + '' === $lockout_message
323 323 ? esc_html__( 'Whoops, the passcode you entered was incorrect or expired.', 'defender-security' )
324 324 : $lockout_message
325 325 );
326 326 }
@@ -345,9 +345,9 @@
345 345 */
346 346 private static function get_user_secret( $user_id ) {
347 347 // First, we check the new 'TOTP_SODIUM_SECRET_KEY' key.
348 348 $data = get_user_meta( $user_id, self::TOTP_SODIUM_SECRET_KEY, true );
349 - if ( ! empty( $data ) ) {
349 + if ( is_string( $data ) && '' !== $data ) {
350 350 return Crypt::get_decrypted_data( $data );
351 351 }
352 352 // Then check the old 'TOTP_SECRET_KEY' key.
353 353 if ( ( new Two_Fa_Component() )->maybe_update( $user_id ) ) {
@@ -352,9 +352,9 @@
352 352 // Then check the old 'TOTP_SECRET_KEY' key.
353 353 if ( ( new Two_Fa_Component() )->maybe_update( $user_id ) ) {
354 354 // Check a new key again.
355 355 $data = get_user_meta( $user_id, self::TOTP_SODIUM_SECRET_KEY, true );
356 - if ( ! empty( $data ) && is_string( $data ) ) {
356 + if ( is_string( $data ) && '' !== $data ) {
357 357 return Crypt::get_decrypted_data( $data );
358 358 }
359 359 }
360 360
@@ -391,9 +391,9 @@
391 391 * @return string|WP_Error
392 392 * @throws SodiumException Exceptions thrown by the sodium functions.
393 393 */
394 394 private static function generate_otp( $counter, $user_id, $setup_key ) {
395 - if ( empty( $setup_key ) || ! is_string( $setup_key ) ) {
395 + if ( ! is_string( $setup_key ) || '' === $setup_key ) {
396 396 $setup_key = self::get_user_secret( $user_id );
397 397 if ( is_wp_error( $setup_key ) ) {
398 398 return $setup_key;
399 399 }