Skip to content

Commit 619a2da

Browse files
committed
Revert the WP2FA changes
1 parent 5f42a3a commit 619a2da

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

admin/class-admin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,10 @@ public function handle_bulk_user_type_change() {
13301330
wp_die( __( 'Security check failed. Please try again.' ) );
13311331
}
13321332

1333+
if ( ! current_user_can( 'edit_users' ) ) {
1334+
wp_die( __( 'You do not have permission to perform this action.' ) );
1335+
}
1336+
13331337
$new_user_type = absint( $_GET['uwp_new_user_type'] );
13341338

13351339
if ( ! $new_user_type ) {

includes/class-forms.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,10 @@ public function process_login() {
11621162

11631163
remove_action( 'authenticate', 'gglcptch_login_check', 21 );
11641164

1165-
userswp_disable_wp2fa_temporarily();
1165+
global $wp2fa;
1166+
if ( wp_doing_ajax() && isset( $wp2fa ) && ! empty( $wp2fa ) ) {
1167+
remove_action( 'wp_login', array( $wp2fa->login, 'wp_login' ), 20 );
1168+
}
11661169

11671170
$user = wp_signon(
11681171
array(
@@ -1172,11 +1175,9 @@ public function process_login() {
11721175
)
11731176
);
11741177

1175-
//userswp_restore_wp2fa_hooks();
1176-
11771178
add_action( 'authenticate', 'gglcptch_login_check', 21, 1 );
11781179

1179-
if ( wp_doing_ajax() && ! is_wp_error( $user ) && function_exists('\WP2FA\Admin\Helpers\User_Helper') && \WP2FA\Admin\Helpers\User_Helper($user->ID) ) {
1180+
if ( wp_doing_ajax() && ! is_wp_error( $user ) && isset( $wp2fa ) && ! empty( $wp2fa ) ) {
11801181

11811182
$two_fa = $this->check_2fa( $user );
11821183
if ( isset( $two_fa ) && ! empty( $two_fa ) ) {
@@ -1249,6 +1250,7 @@ public function check_2fa( $user ) {
12491250
$user = wp_get_current_user();
12501251
}
12511252

1253+
global $wp2fa;
12521254
$errors = new WP_Error();
12531255

12541256
if ( ! \WP2FA\Admin\Helpers\User_Helper::is_user_using_two_factor( $user->ID ) ) {
@@ -1433,6 +1435,8 @@ public function process_login_2fa() {
14331435
wp_send_json_error( array( 'message' => $message ) );
14341436
}
14351437

1438+
global $wp2fa;
1439+
14361440
$nonce = ( isset( $_POST['wp-auth-nonce'] ) ) ? sanitize_textarea_field( wp_unslash( $_POST['wp-auth-nonce'] ) ) : '';
14371441
if ( true !== \WP2FA\Authenticator\Login::verify_login_nonce( $user->ID, $nonce ) ) {
14381442

0 commit comments

Comments
 (0)