Change incorrect password error message.

Support MB User Profile Change incorrect password error message.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #45626
    Sam KSam K
    Participant

    How can I change the error message for an incorrect password? If the user enters the wrong password, I don't want the error message to confirm that the email exists. I want it to say, "Incorrect email or password" instead of "Error: The password you entered for the email address [email protected] is incorrect."

    Screenshot: https://bit.ly/4b2JdnG

    I appreciate your help. Thank you!

    #45629
    PeterPeter
    Moderator

    Hello Sam,

    It is the default WordPress error message, located in the file wp-includes/user.php line 262 and there isn't a filter hook or option to change this message.

    #49132
    A.A.
    Participant

    I have the same concern as the original poster. I found many snippets online to change the default WP login errors, and they work for me on my usual sites. However, I recently noticed they do not work with MB User Profile messages for some reason. So if I user attempts to log in with the default WP login form, they will see the generic message my custom plugin writes, but if they make the same attempt using the login form created by MB User Profile's shortcode, then it reverts back to the default WP message.

    Furthermore, the Falcon plugin has a security setting to Disable detailed login errors: Show a general error message when the login is incorrect, not specifically whether the username or password is incorrect. But that works like the custom plugin I tried: only for the original WP login form/page.

    Meaning: if either a custom plugin or Falcon is used to change the login errors to a generic message, that will only work on WordPress' default login screen and will NOT work on the login form created by MB User Profile.

    So this makes me think there is something in the MB User Profile code that is making the login form somehow skip the custom plugin or Falcon security override for error messages and display the original WP error messages instead.

    I will keep investigating how that can be overridden too, but I thought to post here instead of creating a new topic in case anyone else researching this issue comes across it.

    #49183
    A.A.
    Participant

    After a lot of trial and error, and consulting of AI, I finally got a working solution that will allow changing the default error message for incorrect password when using a Meta Box login form.

    Quick recap:
    1. The default WP form would display a specific and security concerning type message such as Error: The password you entered for the username <user> is incorrect. Lost your password? which clearly indicates that username or email entered is correct, only the password is not.
    2. The Falcon plugin will override that message if you turn on the security setting to "Disable detailed login errors".
    3. But if you use the Meta Box user profile login form it won't be covered with Falcon's security setting.

    The usual filters for changing default WP login errors would not catch those outputted by the Meta Box login form. I tried many methods, it seems intercepting the translation string works - so it will replace “The password you entered for the username %s is incorrect.” with “Invalid username or email.” or similar text with the generic message.

    However, I feel like this is not the right way to do it and it feels fragile, but wp_authenticate_userand login_errors filters did not work with the Meta Box form when I tried it, and I needed a quick solution for this so opted for this temporary translation string fix.

    Can Meta Box be updated to allow for custom login related error messages or at least to adhere to the Falcon security setting? A long time has passed since the original post in this thread, perhaps the core code now has safer more robust methods that can be used for this essential security concern.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.