Register Plus Redux
Proposed fix for login/password problem (with woocommerce) (2 posts)

  1. dwlorimer
    Posted 2 years ago #

    As we all know, there are some compatibility problems when using woocommerce and register plus redux together.

    I recently experienced the issue where Register Plus Redux login claims the password is too short, saying it must be 6 characters, no matter the length of the actual password.

    I have a solution.

    There appears to be a problem in the way \register-plus-redux\rpr-login.php is written.

    Here's what it's doing, FYI, and for future reference:

    In this file:

    At line 95, it UNSETS $_POST['pass1']

    public /*.string.*/ function rpr_login_filter_random_password( /*.string.*/ $password ) {
    			global $register_plus_redux;
    			global $pagenow;
    			if ( 'wp-login.php' === $pagenow && '1' === $register_plus_redux->rpr_get_option( 'user_set_password' ) ) {
    				if ( isset( $_REQUEST['action'] ) && 'register' === $_REQUEST['action'] ) {
    					if ( isset( $_POST['pass1'] ) ) {
    						$password = sanitize_text_field( (string) $_POST['pass1'] );
    						// Stowe password in $_REQUEST to allow random password generator to continue while preserving for user_register action
    						$_REQUEST['password'] = $password;
    						unset( $_POST['pass1'] );
    			return $password;

    Then, at lines 437 and 440, it checks for the variable again. As best as I can tell, line 95 executes before lines 437 and 440 (they are in different functions).

    if ( '1' === $register_plus_redux->rpr_get_option( 'user_set_password' ) ) {
    				if ( empty( $_POST['pass1'] ) && '1' !== $register_plus_redux->rpr_get_option( 'disable_password_confirmation' ) ) {
    					$errors->add( 'empty_password', '<strong>' . __( 'ERROR', 'register-plus-redux' ) . '</strong>:&nbsp;' . __( 'Please enter a password.', 'register-plus-redux' ) );
    				elseif ( strlen( (string) $_POST['pass1'] ) < absint( $register_plus_redux->rpr_get_option( 'min_password_length' ) ) ) {
    					$errors->add( 'password_length', sprintf( '<strong>' . __( 'ERROR', 'register-plus-redux' ) . '</strong>:&nbsp;' . __( 'Your password must be at least %d characters in length.', 'register-plus-redux' ), absint( $register_plus_redux->rpr_get_option( 'min_password_length' ) ) ) );

    So, all I did was comment out the unset on line 95, and everything started working again.

    According to the code surrounding line 95, it appears to me that the later lines should be calling the $password variable, instead of $_POST['pass1'], but none of them do.

    So this fix works (of just commenting out the unset), but I think there's an underlying problem in the plugin itself.

    This fix works for me using Register plus Redux with WooCommerce
    You can see it in action at our site:

    Developers, please investigate this solution and include in your next plugin release.


  2. burnbright
    Posted 2 years ago #

    Just a heads up I was experiencing the same issue, and your fix worked for me as well.

    Very timely for me. Thank you!


Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic