• Resolved dougar

    (@dougar)


    Hello. Thank you for all the effort put in on this great plugin.
    
    While upgrading my version of Defender, I ran into a problem with how the registration page is working. In particular, the Masking Login URL Slug that is set in Defender is not being used during the very last step of registration. I am testing this in a WordPress clone area.
    
    For example:
    Clone URL = https://example.com/clone123
    Login = https://example.com/clone123/maskingslug
    Register URL = https://example.com/clone123/maskingslug?action=register
    On this page, the new user can register, and it puts the new user information correctly in the database.
    It also correctly sends an email to the user to set the password for the first time.
    It then automatically takes the user, incorrectly, to =
    https://example.com/clone123/wp-login.php?checkemail=registered
    This correctly displays the error:
    "This feature is forbidden temporarily for security reason. Try login again."
    The problem is that it should not use "wp-login.php", but instead use "maskingslug".
    For completeness, the link to change the password works correctly and does use the masking slug. And then the user is able to log in correctly - the login page also uses the masking slug.
    
    I'm not a WP programmer. I did turn masking off, and then on again. No change.
    
    By installing different versions of Defender, I discovered that the problem seems to exist for Defender versions starting with 4.1.0, up to and including the latest 4.5.0 version.
    
    Here are the specific Defender versions I tested:
    Registration worked correctly: 2.6.5 - 2.8.3 - 3.12.0 - 4.0.2
    Registration last step not working: 4.1.0 - 4.3.1 - 4.4.2 - 4.5.0
    
    I have been able to replicate this problem on a test WP website 5.6.13 that looks like a clone (but was a new installation) with no plugins except for Defender 4.5.0. Again, the last registration step gives an error.
    
    Here are the settings on my website:
    WordPress Version = 5.6.13
    PHP Version = 7.4.33
    Redirect Traffic = off
    2FA is not used
    Permalinks under WP Settings = Post name
    
    I'm happy to upgrade to Defender 4.0.2 for now.
    In the future, once the above works, I'll upgrade to the newest version.
    Many thanks.
    Doug
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @dougar

    I hope you’re well today and thank you for reporting it.

    I checked on my end and I can replicate this issue so I’ve already reported it to our Defender Team. Developers will look into it to address it with one of future releases (though at this point I’m not able to provide ETA).

    As for now, you can use this code on site as a temporary workaround:

    <?php 
    add_filter( 'registration_redirect', 'redirect_masked_registration', 11, 1 );
    function redirect_masked_registration( $registration_redirect ) {
    	return home_url().'/slug/';
    }

    You’d need to add it as MU plugin to the site:

    – create an empty file with a .php extension (e.g. “masked-registration-redirect.php”) in the “/wp-content/mu-plugins” folder of your site’s WordPress installation on server

    – copy and paste above code into it

    – replace the /slug/ part in the code with your actual masked login slug

    – and save the code.

    It should work out of the box and redirect after registration to the masked login URL.

    Best regards,
    Adam

    Thread Starter dougar

    (@dougar)

    Hi Adam. Thanks for replying so quickly, and with a solution!

    I upgraded the clone area to Defender 4.5.1 (nice that a new release just came out today!) And I followed your instructions above. During my testing, I realized it does exactly what I asked for… after registration, it redirects the user to the masked login page. But now I realize that isn’t what I want. I want it to work like it does in Defender 4.0.2, which is to redirect the user to the page with this “success” message:

    Registration complete. Please check your email, then visit the login page.

    In other words, instead of redirecting to here:
    https://example.com/clone123/wp-login.php?checkemail=registered (the original problem)
    and instead of redirecting here:
    https://example.com/clone123/maskingslug/ (what I asked for above)
    I actually want it to redirect to:
    https://example.com/clone123/maskingslug?checkemail=registered

    So I took the liberty of changing the last part of your code slightly, 
    from:
       return home_url().'/slug/';
    }
    to:
       return home_url().'/slug?checkemail=registered';
    }

    The entire piece of code is:

    <?php 
    add_filter( 'registration_redirect', 'redirect_masked_registration', 11, 1 );
    function redirect_masked_registration( $registration_redirect ) {
    	return home_url().'/slug?checkemail=registered';
    }
    

    It seems to work great. ??
    I realize it is not elegant… I have hardcoded the part from the question mark onward, assuming the registration will be successful. But for my website’s purpose, this should be fine.

    Thanks again. I’ll be upgrading to Defender 4.5.1 in production with the new MU code.
    Have a great day.
    Doug

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @dougar

    Thank you for updated and sharing your solution!

    I’m also glad I could help ??

    Since this seems to be solving the issue for now I’m marking this topic as resolved.

    I’m not sure if the full/proper fix will come in upcoming release or a bit later – it still requires to be checked by developers, coded, implemented and confirmed by QA team – but this workaround should work anyway. Please keep an eye on plugin’s changelog and when any fix related to this is included – it will be listed there.

    Best regards,
    Adam

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Masking URL Login Causing Registration Problem’ is closed to new replies.