is_valid_request() ) { return; } // phpcs:disable WordPress.Security.NonceVerification.Missing $api_key = isset( $_POST['api_key'] ) ? sanitize_text_field( wp_unslash( $_POST['api_key'] ) ) : ''; $username = isset( $_POST['username'] ) ? sanitize_text_field( wp_unslash( $_POST['username'] ) ) : ''; // phpcs:enable WordPress.Security.NonceVerification.Missing if ( ! $api_key || ! $username ) { $this->redirect_to_home(); } if ( $api_key !== flywp()->get_api_key() ) { $this->redirect_to_home(); } if ( is_user_logged_in() ) { $this->redirect_to_admin(); } $user = get_user_by( 'login', $username ); if ( ! $user ) { $this->redirect_to_admin(); } wp_set_current_user( $user->ID, $user->user_login ); wp_set_auth_cookie( $user->ID ); // redirect to admin $this->redirect_to_admin(); } }