I want to force people to log in with their email address instead of their username, because usernames can be seen by other people users, which I thought was not good for security.
Where can I find the file with the login requirements?
I want to force people to log in with their email address instead of their username, because usernames can be seen by other people users, which I thought was not good for security.
Where can I find the file with the login requirements?
Please let me know if you mean the login or registration process? Because usernames may still be visible outside of the login form, e.g. in user profile URLs if you enabled user profiles, or in messages/reviews if you use these extensions and the display name is set to Username in HivePress/Settings/Users.
If you mean just the login form, it’s possible if you change the “Username or Email” text to just “Username” via Loco plugin, and also a custom code snippet would be needed to alter the validation of this field to require a valid email address.
Thanks for the reply.
I mean customising the code to require an email address instead of a username when logging in. When you register as a member, you register a username and an email address, and also that username is displayed in various places.
The login text form has already been changed from ‘username or email’ to ‘email’.
The purpose of this is to stop malicious users, rather than ordinary users, from attempting to log in using someone else’s username, which is displayed everywhere.
Hi,
Thanks for the clarification. Then the guidelines are the same as those provided by Ihor, and if you have already changed the label in Loco Translate, then you will need a custom implementation, namely a hook to the login form hivepress/v1/forms/user_login
and change the type to email for the username_or_email
field.
Unfortunately, I can’t understand how to use the hook. What is wrong with this code?
I would be delighted if you could tell me the correct code.
apply_filters
( 'hivepress/v1/forms/user_login',
'fields' => [
'username_or_email' => 'email' ])
Hi,
Sorry for the inconvenience, but customization is beyond our support scope - it includes fixing bugs and guidance about the available features Support Policy | HivePress
If customizations are required for your site, please try customizing it using the collection of code snippets https://gist.github.com/search?q=user%3Ahivepress and other developer resources, or consider hiring someone for custom work Experts | HivePress