-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add field on Auth endpoint for email or username from single input #19
Comments
+1 for this. |
You can take this field from jwt, let's decode it |
This is on the |
How should you decode the Jwt? |
You would decode this the same as any other endpoint. If you're having trouble with this, you should open a new issue, as this is not related to this issue. |
Would it not be better to check in the current endpoint as is whether the user passed an email or username via the username field? This would, IMHO, be better than adding another field. |
@nicumicle I have created a patch to allow the username field to contain either the username or email for the /auth endpoint. I have tested it on my local dev server and found no problems. This will allow the username field to behave in the same way as the username input on the Standard WP login. |
Is your feature request related to a problem?
WordPress login forms allow users to enter either a username or email address in the same field for logging in, but this plugin makes you have to determine whether a field is a username or email address before it's sent to the auth endpoint. The only effective way to tell this is in the WP admin by seeing if a user exists, as usernames allow
@
and.
even in strict mode.Describe the solution you'd like
An optional field added to the auth endpoint called username_or_email. If the auth endpoint is called with this parameter, it should try to find a user by username and if it doesn't exist, try to find the user by email address instead, and if fails both, then throw an error.
You can use the get_user_by function to achieve this.
I don't have time to work on this myself at the moment, but I can probably submit a pull request for this in a couple of months if you don't have time to work on this yourself.
The text was updated successfully, but these errors were encountered: