From b52113c18cda39d474cd93b8e3b345100fe98097 Mon Sep 17 00:00:00 2001 From: Jan Boddez Date: Mon, 12 Aug 2024 12:41:54 +0200 Subject: [PATCH 1/2] Update class-indieauth-authorize.php --- includes/class-indieauth-authorize.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-indieauth-authorize.php b/includes/class-indieauth-authorize.php index e58d260..43d1849 100644 --- a/includes/class-indieauth-authorize.php +++ b/includes/class-indieauth-authorize.php @@ -91,7 +91,7 @@ public function get_indieauth_response( $response ) { public function rest_authentication_errors( $error = null ) { if ( is_user_logged_in() ) { // Another OAuth2 plugin successfully authenticated. - return null; + return $error; } if ( ! empty( $error ) ) { @@ -103,7 +103,7 @@ public function rest_authentication_errors( $error = null ) { if ( is_oauth_error( $this->error ) ) { return $this->error->to_wp_error(); } - return null; + return $error; } /** From 199e42d885ba2cf8bb8ecec7902975fd1530d9f2 Mon Sep 17 00:00:00 2001 From: Jan Boddez Date: Mon, 12 Aug 2024 19:53:37 +0200 Subject: [PATCH 2/2] Update class-indieauth-authorize.php --- includes/class-indieauth-authorize.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/class-indieauth-authorize.php b/includes/class-indieauth-authorize.php index 43d1849..2beeb29 100644 --- a/includes/class-indieauth-authorize.php +++ b/includes/class-indieauth-authorize.php @@ -84,9 +84,9 @@ public function get_indieauth_response( $response ) { * Attached to the rest_authentication_errors filter. Passes through existing * errors registered on the filter. * - * @param WP_Error|null Current error, or null. + * @param WP_Error|null|true Current error, null or true. * - * @return WP_Error|null Error if one is set, otherwise null. + * @return WP_Error|null|true Error if one is set, unchanged otherwise. */ public function rest_authentication_errors( $error = null ) { if ( is_user_logged_in() ) { @@ -94,15 +94,14 @@ public function rest_authentication_errors( $error = null ) { return $error; } - if ( ! empty( $error ) ) { - return $error; - } if ( is_wp_error( $this->error ) ) { return $this->error; } + if ( is_oauth_error( $this->error ) ) { return $this->error->to_wp_error(); } + return $error; }