Support » Fixing WordPress » How to remove Confirm Use of Weak Password checkbox for users ?

  • Resolved worldless

    (@worldless)


    Users after registration receive a verification email where they can change their password. I’d like to let them all use a strong password. I don’t like to use any plugins for this. all I want is remove the Use of Weak Password completely not by just simply hiding it using css.

    Any idea ?!

Viewing 15 replies - 1 through 15 (of 15 total)
  • shariqkhan2012

    (@shariqkhan2012)

    You can remove it with a bit if jQuery, if that helps

    jQuery('.pw-weak').remove();

    worldless

    (@worldless)

    Thanks but where would I exactly put this ? I wish there was a simpler way like my theme’s function.php

    shariqkhan2012

    (@shariqkhan2012)

    That depends whether you are using a child theme or not.

    1. You are using a child theme
    a. if the child theme has a JavaScript file, then put the above code in there.
    b. If it does not or if you are confused, then better to employ function.php to put the code. In that case, the code would be:

    function worldless_custom_script() {
    	?>
    		<script>
    			jQuery(document).ready(function() {
    				jQuery('.pw-weak').remove();
    			});
    		</script>
    	<?php
    }
    add_action('wp_head','worldless_custom_script');

    2. You are NOT using a child theme
    In this case, install a plugin like Code Snippets
    And put the same code as in 1 b in one of the snippets.

    worldless

    (@worldless)

    @shariqkhan2012 I have a question. why would I use a code snippet plugin or child theme when I can simply put the codes in my function.php ? I have a couple of codes added to my function.php and all of them work just fine. I’m not worried about updates at all because I barely receive any updates for my custom theme and If I do, it’ll be a simple copy paste.

    Having said that I tried your code in my function.php and it didn’t work. but I can easily hide it using display: none in login.min.css

    .login .pw-weak{
      margin-bottom:15px; 
      display:none !important;
    }

    But it has too many drawbacks:

    1. It’s possible to disable it with Firebug or any other tools and register using a weak password.

    2. it’s in admin folder and with any updates it’ll be removed not to mention that admin css codes don’t work in theme’s style.css

    I wish WordPress could give us an option on letting users have a simple/strong password in General Settings…

    Any other options ?

    shariqkhan2012

    (@shariqkhan2012)

    I wasn’t aware you are using a custom theme. If you are, then yes are correct, best place to add the code is in the functions.php

    In the code snippet, I gave please change the line:
    add_action('wp_head','worldless_custom_script');
    to
    add_action('admin_head','worldless_custom_script');

    And then see if it fixes the problem.

    it’s in admin folder

    Sorry, I did not get what you meant here. Could you please explain it again?

    I wish WordPress could give us an option on letting users have a simple/strong password in General Settings…

    I think there a couple of plugins that enforce strong passwords

    worldless

    (@worldless)

    I wasn’t aware you are using a custom theme

    I’m using Napoli theme if it helps

    unfortunately it didn’t fix the issue either.

    Sorry, I did not get what you meant here. Could you please explain it again?

    Sure. by admin folder I meant the css code pertaining to the .pw-weak is located in the admin (css) folder and because of that I can’t even hide .pw-weak in my theme’s style.css either because style.css can’t accept css codes from admin and if make the changes right there, with any simple update it’ll be removed. I was just explaining that I can’t even hide it using css not to mention that css can be easily bypassed.

    I think there a couple of plugins that enforce strong passwords

    I know there are some plugins that can do the job nice and easy but I’d rather use the default option and all I need is disable the Confirm Use of Weak Password.

    • This reply was modified 2 years ago by worldless.
    • This reply was modified 2 years ago by worldless.
    shariqkhan2012

    (@shariqkhan2012)

    I just tried and it removed the ‘Confirm use of weak password’ checkbox from my site, so it seems to be working okay.

    Can you please recheck whether you have put this exact code in the correct place?

    function worldless_custom_script() {
    	?>
    		<script>
    			jQuery(document).ready(function() {
    				jQuery('.pw-weak').remove();
    			});
    		</script>
    	<?php
    }
    add_action('admin_head','worldless_custom_script');
    worldless

    (@worldless)

    Now I know what the problem is…
    You’re trying to remove that option from Users in the back-end (the Admin area). I explained earlier what I meant by admin folder. I didn’t mean the back-end.

    No that’s not what I’m looking for and Yes.. it absolutely works fine and I guess I’m gonna have to save it somewhere cause I might need it some day. but like I said in my first post when users sign up, they receive a verification email where they can click on a link (in their email inbox) to set a password for the first time. as you know without setting the password for the first time they can’t have access to dashboard.

    So all you need to do is register as a user and then check your inbox (or spam folder) and finally click on the given link to set your password. you’ll see that Confirm use of weak password is still there.

    worldless

    (@worldless)

    Once again I confirm that your code works fine in the admin area but not when you register as a user and then verify your email to set a password from there !

    • This reply was modified 2 years ago by worldless.
    shariqkhan2012

    (@shariqkhan2012)

    This should work:

    function worldless_custom_script() {
    	?>
    		<script>
    			jQuery(document).ready(function() {
    				jQuery('.pw-weak').remove();
    			});
    		</script>
    	<?php
    }
    add_action('admin_head','worldless_custom_script');
    
    function worldless_login_custom_script() {
    	?>
    		<script>
    			document.addEventListener("DOMContentLoaded", function(event) { 
    				var elements = document.getElementsByClassName('pw-weak');
    				console.log(elements);
    				var requiredElement = elements[0];
    				requiredElement.remove();
    			});
    		</script>
    	<?php
    }
    add_action('login_enqueue_scripts','worldless_login_custom_script');
    worldless

    (@worldless)

    Excellent !!!

    That’s exactly what I needed. it removed it from every where…

    I really appreciate it.

    shariqkhan2012

    (@shariqkhan2012)

    You are welcome. Glad that it worked for you.

    Hi everyone,

    Thanks shariqkhan2012 for the hook.

    I want to know to change the policy of password with :
    At least 10 characters in length, and have at least one uppercase letter, one lowercase letter, and one number.

    is it possible with a hooks?

    THANKS

    I read the contents of this topic in another article, but it was different from these comments روغن خراطین

    @momosampaii Sorry, I somehow missed your message. It is possible using custom Javascript, but I guess there would be a couple of plugins to enforce the password strength criteria that you want. Here is one such plugin, although it has not been updated in a while, but you get the idea.

    @talangor I did not get what you want to convey. COuld you please describe in a bit more detail?

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘How to remove Confirm Use of Weak Password checkbox for users ?’ is closed to new replies.