• ironlion37

    (@ironlion37)


    Hi, because of the way my site template works, I need to stop WordPress from pre-populating a new password when a user is brought back to the site after clicking on the password reset link in the email they get.

    I just want them to be taken to the password reset page, have the password field be blank, and type in their own password. The template I use has a weak/strong filter on the password field.

    Is this possible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • frankamaya

    (@frankamaya)

    Hey there,

    I think there is a way to do it; by editing the functions.php file. I strongly suggest having a child theme active when working on the functions.php file and making sure to create a copy of the functions.php file just to be safe before you make any modifications.

    Via FTP/SFTP/SSH or via the ‘Theme File Editor’ (under Appearance > Theme File Editor) edit the functions.php file and add the following code to the end of the file:

    function disable_autofill_password_reset( $args, $user ) {
        $args['autocomplete'] = 'off';
        return $args;
    }
    add_filter( 'rp_generate_password_form_args', 'disable_autofill_password_reset', 10, 2 );
    

    Save the changes (and upload the file if you were doing it via SFTP/FTP) and clear your browser cache.

    This code adds a filter to the WordPress password reset process that sets the autocomplete attribute of the password input field to off. This should prevent the browser from auto-filling any predefined password on the reset password page.

    I hope this helps.

    Thread Starter ironlion37

    (@ironlion37)

    Thank you but that didn’t work. Carefully cleared all caches and it’s still pre-populating the password. I even switched templates to be sure.

    Thread Starter ironlion37

    (@ironlion37)

    Any other ideas? I have a staging site set up for testing (though we’re talking about core WP functionality here).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘The Password Reset Process’ is closed to new replies.