Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update class-indieauth-authorize.php #273

Merged
merged 4 commits into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading