Skip to content

Commit

Permalink
Merge pull request #273 from janboddez/janboddez-patch-jetpack-error
Browse files Browse the repository at this point in the history
Update class-indieauth-authorize.php
  • Loading branch information
dshanske authored Aug 13, 2024
2 parents 20ed0b0 + eaa45b0 commit e810911
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions includes/class-indieauth-authorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,25 @@ 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() ) {
// Another OAuth2 plugin successfully authenticated.
return null;
}

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 null;

return $error;
}

/**
Expand Down

0 comments on commit e810911

Please sign in to comment.