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

'Authentication failed' message converted in plain text #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sviluppomania
Copy link

A failed authentication on /token no more returns an HTML message.

Before this commit, the /token endopoint was returning thw Wordpress default error for a failed login. This was an HTML string with a link to recover the password.

Dealing with REST API it's better to always have plain text as a message

A failed authentication on /token no more returns an HTML message.

Before this commit, the /token endopoint was returning thw Wordpress default error for a failed login. This was an HTML string with a link to recover the password.

Dealing with REST API it's better to always have plain text as a message
@sun sun added the needs tests Automated tests should be adjusted in './tests' label May 18, 2022
@@ -183,7 +183,7 @@ public function get_token( WP_REST_Request $request ) {
'success' => false,
'statusCode' => 401,
'code' => $error_code,
'message' => strip_tags( $user->get_error_message( $error_code ) ),
'message' => strip_tags('Authentication failed: '.$error_code),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing code removes HTML tags already, so I'm not sure what this PR actually changes (other than removing a potentially more helpful error message for the end-user)…?

@sun sun removed the needs tests Automated tests should be adjusted in './tests' label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants