• Resolved jamesstcrice

    (@jamesstcrice)


    Hi there,

    Nice work on the plugin

    For security purposes I am trying to make it as indistinguishable as possible when someone enters a username/email that exists vs when it does not.

    I have customized the error/notice shown so they are the same text and visually the same. But when the username/email exists, it stays on the forgot password form – when the username/email does exist, it redirects to the login page.

    I have used to the ‘lostpassword_redirect’ filter to instead keep the user on the forgot password page – however when I use that redirect, no error or notice appears on the form, so it just seems like nothing has happened.

    Is there a way to force a notice to appear on the forgot password page after a redirect?

    Thanks very much

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    In this case, you would need to replace the default action handler for the lostpassword action. The following should work if not using AJAX:

    
    function custom_tml_lostpassword_handler() {
        if ( tml_is_post_request() ) {
            // Remove the default callback hook
            tml_get_action()->remove_callback_hook();
    
            $errors = tml_retrieve_password();
            if ( ! is_wp_error( $errors ) ) {
                // This is a success
                tml_add_error( 'success', 'If this username/email existed, you will receive an email.', 'message' );
            } else {
                // This is an error
                tml_set_errors( $errors );
            }
        }
    }
    add_action( 'tml_action_lostpassword', 'custom_tml_lostpassword_handler' );
    
    Thread Starter jamesstcrice

    (@jamesstcrice)

    This is perfect, thank you very much

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘show notice on forgot password form’ is closed to new replies.