How to requied password set on signup page?

Hi,

How I can set requied password filling on signup page? Is there any option to enable it? Cause we talking about there:

https://premium.wpmudev.org/forums/topic/insert-user-password-to-message#post-992578

The WordPress can't show and send generated password, so I want to set this.

Thanks,
Ferenc

  • Kasia Swiderska

    Hello Ferenc,

    You can do that with slight modification of the plugin and small script added to your functions.php file

    In plugin file signup-password.php in line 273 find this code:

    <input name="password_1" type="password" id="password_1" value="" autocomplete="off" maxlength="20" /><br />
    		(<?php _e('Leave fields blank for a random password to be generated.', 'signup_password') ?>)
        <label for="password"><?php _e('Confirm Password', 'signup_password'); ?>:</label>
    		<input name="password_2" type="password" id="password_2" value="" autocomplete="off" maxlength="20" /><br />

    and change it to the

    <input name="password_1" type="password" id="password_1" value="" autocomplete="off" maxlength="20"required="required" /><br />
    
        <label for="password"><?php _e('Confirm Password', 'signup_password'); ?>:</label>
    		<input name="password_2" type="password" id="password_2" value="" autocomplete="off" maxlength="20" required="required" /><br />

    then in your theme functions.php file add this code

    add_action( 'wp_footer', 'wpmu_remove_novalidate' );
    function wpmu_remove_novalidate() {
    
    ?>
    <script type="text/javascript">
        jQuery(document).ready(function() {
        	jQuery('#setupform').removeAttr( "novalidate" );
        });
    </script>
    <?php
    }

    this will enable validation for the password field and made it required.

    Kind regards,
    Kasia

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.