From edf24d2d4eb417e6ed3383b70a781f43e5022350 Mon Sep 17 00:00:00 2001 From: Kaspars Dambis Date: Thu, 19 Sep 2024 14:20:48 +0300 Subject: [PATCH] Disable on deactivate --- providers/class-two-factor-totp.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/providers/class-two-factor-totp.php b/providers/class-two-factor-totp.php index 4229e82d..99786bd3 100644 --- a/providers/class-two-factor-totp.php +++ b/providers/class-two-factor-totp.php @@ -151,6 +151,10 @@ public function rest_delete_totp( $request ) { $this->delete_user_totp_key( $user_id ); + if ( ! Two_Factor_Core::disable_provider_for_user( $user_id, 'Two_Factor_Totp' ) ) { + return new WP_Error( 'db_error', __( 'Unable to disable TOTP provider for this user.', 'two-factor' ), array( 'status' => 500 ) ); + } + ob_start(); $this->user_two_factor_options( $user ); $html = ob_get_clean();