Problem/Motivation

For many sites, when a user changes their password, the password strength indicator can be both annoying and unnecessary. Currently it can only be disabled using a custom module and changes to the javascript function that checks the password.
It would be useful if a website administrator could disable the password strength indicator through the user interface.

Proposed resolution

Add a checkbox on the Account settings page that enables a website administrator to determine if the password strength indicator is displayed. The password strength indicator would default to 'on'.

Remaining tasks

Steps to test

  1. Install Drupal 8.x using the standard profile.
  2. Apply patch in #72
  3. Login as admin
  4. Configuration menu > People > Account settings (admin/config/people/accounts) Registration and Cancellation fieldset
  5. Confirm new checkbox "Enable password strength generator" (default off), positioned below existing checkbox "Require e-mail verification when a visitor creates an account."
  6. My Account > Edit tab (user/1/edit)
  7. Confirm no password strength generator
  8. Return to Registration and Cancellation and check "Enable password strength generator"
  9. Click "Save configuration"
  10. Return to My Account > Edit tab
  11. Confirm password strength generator is now active

User interface changes

Addition of an 'Enable password strength indicator' on the Account settings page in the 'Registration and cancellation' section.

API changes

None

Original report by adamfeldman

There should be an option to disable the password strength check in the settings for user registration. Right now it can only be disabled by a custom module with a hack messing with the javascript function that checks the password.

CommentFileSizeAuthor
#114 password-strength-optional-432962-114.patch823 bytesechoz
#114 password-strength-narrow-before.png59.7 KBechoz
#114 password-strength-narrow-after.png59.71 KBechoz
#103 drupal_password_strength_optional_with_test-432962-103.patch11.12 KBshnark
#103 interdiff-98-103.txt905 bytesshnark
#100 interdiff-432962-90-98.txt670 bytesAnonymous (not verified)
#98 drupal_password_strength_optional_with_test-432962-98.patch11.12 KBAnonymous (not verified)
#90 drupal_password_strength_optional_with_test-432962-90.patch11.24 KBAnonymous (not verified)
#90 interdiff.txt670 bytesAnonymous (not verified)
#90 432962-before-warning-message-added.png176.8 KBAnonymous (not verified)
#90 432962-after-warning-message-added.png162.85 KBAnonymous (not verified)
#90 432962-sans-warning-message.png162.85 KBAnonymous (not verified)
#90 432962-warning-message.png176.8 KBAnonymous (not verified)
#84 strength-disabled.png155.51 KBAnonymous (not verified)
#84 drupal_password_strength_optional_with_test-432962-84.patch11.12 KBAnonymous (not verified)
#83 password_strength_broken.png8.21 KBadammalone
#80 2_Config-people-accounts-afterPATCH.png46.59 KBsimon.j.c
#80 3_UserEdit-after_patch.png24.24 KBsimon.j.c
#77 before_settings.png67.81 KBchaloum
#77 before-fields.png30.06 KBchaloum
#77 after_settings.png68.17 KBchaloum
#77 after_fields.png18.35 KBchaloum
#72 drupal_password_strength_optional_with_test-432962-72.patch11.12 KBAnonymous (not verified)
#72 account_settings_no_description_432962.png300.53 KBAnonymous (not verified)
#70 drupal_password_strength_optional_with_test-432962-70.patch11.28 KBAnonymous (not verified)
#70 install_password_indicator_enabled_432962.png294.23 KBAnonymous (not verified)
#70 install_password_indicator_disabled_432962.png290.23 KBAnonymous (not verified)
#70 account_settings_before_432962.png330.77 KBAnonymous (not verified)
#70 account_settings_after_432962.png317.24 KBAnonymous (not verified)
#70 account_edit_indicator_enabled_432962.png256.33 KBAnonymous (not verified)
#70 account_edit_indicator_disabled_432962.png267.06 KBAnonymous (not verified)
#65 drupal_password_strength_optional_with_test-432962-65.patch11.42 KBAnonymous (not verified)
#59 install.png123.37 KBAnonymous (not verified)
#59 install-type.png117.72 KBAnonymous (not verified)
#58 password-strength-checking-screenshot.jpg8.6 KBedrupal
#56 password-strength-install.png56.39 KBAnonymous (not verified)
#55 drupal_password_strength_optional_with_test-432962-55.patch11.42 KBdags
#55 interdiff.txt805 bytesdags
#54 drupal_password_strength_optional_with_test-432962-54.patch11.37 KBdags
#54 interdiff.txt6.66 KBdags
#53 drupal_password_strength_optional_with_test-432962-44-46-interdiff.txt975 bytesAnonymous (not verified)
#53 drupal_password_strength_optional_with_test-432962-46-47-interdiff.txt1.05 KBAnonymous (not verified)
#53 drupal_password_strength_optional_with_test-432962-47-50-interdiff.txt3.73 KBAnonymous (not verified)
#50 drupal_password_strength_optional_with_test-432962-50.patch9.81 KBAnonymous (not verified)
#47 drupal_password_strength_optional_with_test-432962-47.patch8.14 KBdags
#47 interdiff.txt2.96 KBdags
#46 drupal_password_strength_optional_with_test-432962-46.patch8.13 KBAnonymous (not verified)
#46 pass-strength-admin-old.png38.31 KBAnonymous (not verified)
#46 pass-strength-admin.png40.03 KBAnonymous (not verified)
#46 pass-strength-undefined-errors.png17.58 KBAnonymous (not verified)
#46 pass-strength-undefined-install-errors.png27.7 KBAnonymous (not verified)
#46 pass-strength-undefined.png8.6 KBAnonymous (not verified)
#44 tests_only.patch2.25 KBdags
#44 drupal_password_strength_optional_with_test-432962-44.patch8.11 KBdags
#37 test_only.patch1.09 KBdags
#37 drupal_password_strength_optional_with_test-432962-37.patch7.53 KBdags
#36 drupal_password_strength_optional_432962-37.patch6.44 KBdags
#36 interdiff.txt6.21 KBdags
#35 drupal_password_strength_optional_432962-36.patch4.12 KBdags
#32 drupal_password_strength_optional_432962-32.patch4.12 KBRob C
#31 irritating-security.gif8.63 KBdarioshanghai
#19 disable_pw_strength.patch2.61 KBmcrittenden
#10 password_strength.png27.66 KBmikejoconnor
#5 password_strength_settings.patch3.29 KBdawehner
#4 password_strength_settings.patch2.97 KBmcrittenden
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mcrittenden’s picture

I agree. For many sites the password check is annoying/confusing/unnecessary.

I spoke with adamfeldman on IRC about this issue. He has the code needed to make the change and is planning to make a module out of it. When this happens, I or someone else can roll a patch out of it.

adamfeldman, please link to your module whenever you get it online.

adamfeldman’s picture

mcrittenden’s picture

Status: Active » Needs work

Cool, I'll work on it tomorrow.

mcrittenden’s picture

Status: Needs work » Needs review
FileSize
2.97 KB

Here's a first try at a patch -- adds a checkbox to the User Settings page to disable/enable password strength checking:

dawehner’s picture

the default values, of the variable changes.

i suggest to enable it by default so here is a new patch.

i'm not really sure, whether the variable name is the best

mcrittenden’s picture

Thanks for the default variable fix. Any suggestions on the variable name?

mcrittenden’s picture

Assigned: Unassigned » mcrittenden
dawehner’s picture

what about user_password_dynamic_validation ?
like the functionname.

or user_password_js_validation

mcrittenden’s picture

Title: Adding a UI to disable the password strength check » Add option to disable password strength checking

I'm not in favor of putting the word "validation" into the variable name, just because its main purpose is to check the password's strength, not to validate it.

mikejoconnor’s picture

FileSize
27.66 KB

I think this is a great option to give the administrator, however the current patch changes the layout of the password fields. We should keep the password field layout the same regardless of the strength checker.

mikejoconnor’s picture

Status: Needs review » Reviewed & tested by the community

Actually, the field layout is done by the javascript, the layout change is simply a product of not adding the password checker js. Looks good to me.

Dries’s picture

Status: Reviewed & tested by the community » Needs review

I'm not sure we need this option. In 95% of the cases, it _is_ useful to have the password strength check.

However, I'm happy to have the discussion because I could be wrong. In what cases do you want to disable the checker?

moshe weitzman’s picture

Perhaps this is motivated by the scary password checker in d6. the one in d7 is much friendlier. I think the patch is committable still, though. If Dries disagrees, maybe use a variable with no UI?

mikejoconnor’s picture

In concept I think a password strength meter is a great feature, however in use I personally question its effectiveness, especially based on your target audience. For example a forum site on the topic of web security would have little use for a password strength checker, and a sysadmin would probably recieve emails about how inaccurate the standard password security meter was.

On the other side of things, if I were to setup a site for my extend family to share news/photos, I would get a few phone calls about what the password meter was. In this case, although the password meter might be a good service for teaching my family about password security, I don't think it would be a good use of my time. Furthermore, I doubt the content of the site is vitally important.

In both of these edge cases, I think the site administrator best knows their audience, and content. Although there are many other ways to hide this feature based on your target audience, I think a check box on the user settings page is by far the most usable.

mcrittenden’s picture

+1 for mikejoconnor's comments. Some sites don't need it because the users are too advanced to need it, and some sites don't need it because the users aren't advanced enough to understand it. Either way, the admin should have the power to decide.

timmillwood’s picture

I'm personally don't see the need to have an option to disable the password strength checker in core and think it is placed in contrib module, but really can't think of a good argument why not to put it in core.

mcrittenden’s picture

In response to timmillwood, I think it's confusing for it NOT to be in core. Password strength checking, while cool and sometimes useful, is such a superfluous thing that it doesn't make sense for it to be there without my permission, IMHO. I'm sort of surprised that it made it to core in the first place.

Also, D6 module is now at http://drupal.org/project/disablepwstrength.

Status: Needs review » Needs work

The last submitted patch failed testing.

mcrittenden’s picture

FileSize
2.61 KB

Rerolled to match HEAD.

mcrittenden’s picture

Status: Needs work » Needs review
mcrittenden’s picture

Priority: Normal » Minor

Marking "minor" since nobody seems crazy about it. I'd still like to see it in there, though.

Status: Needs review » Needs work

The last submitted patch failed testing.

mcrittenden’s picture

Version: 7.x-dev » 8.x-dev

Probably too late for 7.x

sobi3ch’s picture

subscribing +1

mcrittenden’s picture

Assigned: mcrittenden » Unassigned
mokko’s picture

I find it a pretty tough requirement to ask for a hard password which requires a combination of punctuation, capital, small letters and numbers! A user just made me aware that neither his bank nor his emails ask this of him. This has to be configurable if Drupal wants to continue to appeal to wide variety of different users.

MBroberg’s picture

I have users that like using comfortable, familiar, easy passwords. They feel that the warnings force them to change to a difficult password, then they forget what it was, then they get upset that this is "required". A warning might be nice, but gentler, so that they don't feel like it is mandatory (they usually don't read fine print) .
So yes it is needed and should be up to the site designer.

glass.dimly’s picture

This should be an option to disable. Some users find this confusing, I've watched them be confused by it, and it should definitely be an option to disable.

Sad this didn't get rolled into 6x, let along 7x.

Why do we feel like we need to be making choices for people? If they want to have insecure or enable insecure passwords on a site, let them.

glass.dimly’s picture

Of course, you can always disable with CSS.

#user-register .password-description {
display:none !important;
}

mikejoconnor’s picture

Out of curiosity, why isn't this entire feature a contrib module? It seems like something that could be easily handled in Contrib. The only reasonable argument I could think of is to ensure that the Admin user has a good password. I personally think that if someone can get a hosting account, and install Drupal, they know what a good password should be.

With that in mind, it seems like this feature is best kept in contrib.

darioshanghai’s picture

FileSize
8.63 KB

Password checker should be optional and disabled.

- it's confusing to use
- it's not necessary. Even big websites don't have one (google? facebook? twitter?)
- it takes a split second to tick the appropriate tickbox to enable, while it can take an hour or two to figure out how to disable it

Speaking as unexperienced developer, it's very frustrating and incredibly time consuming to have to figure stuff out to REMOVE features. In my particular case I have tried for over one hour editing CSS and the damn thing, although invisible, is causing a blank space to appear all of a sudden under the password box, on drupal 7 with the included theme. (See image).

What's gonna happen is that I'll have to just live with it or accept a crappy theme until I learn how to hack the core. This is wrong.

Please consider simplicity a priority. Thank you.

Rob C’s picture

Status: Needs work » Needs review
FileSize
4.12 KB

Complete new patch.

This renders the check disabled by default and offers a checkbox on 'admin/config/people/accounts' to enable it.

Rob C’s picture

Issue tags: +Needs tests

Added this to #1837054: [META] Refactor account workflow (and config)
Will write a test this week if nobody beats me to it.

YesCT’s picture

dags’s picture

dags’s picture

The previous patch was also disabling the password match check, which we probably don't want to do since the user can't go anywhere without confirming their password. Attached is a patch to address that problem.

dags’s picture

And a test. I tried to use XPath assertion here but couldn't get it to work - maybe because it's added by javascript?.

Status: Needs review » Needs work

The last submitted patch, drupal_password_strength_optional_with_test-432962-37.patch, failed testing.

Bojhan’s picture

Issue tags: -Needs usability review

...

Anonymous’s picture

I picked this up yesterday to look at (http://core.drupalofficehours.org/task/1233) before @dags posted patches. I had a patch ready but it's changed now so I'll list what I found for the moment, including the work done by @dags:

user.admin.inc

  • '#type' is set to fieldset whereas every other section is set to 'details' thus is inconsistent with rest of layout
  • '#title' uses 'Pass' instead of 'Password' - better to keep titles to full words
  • '#description' details what the checkbox does not the function itself

Original code:

$form['pass_strength'] = array(
    '#type' => 'fieldset',
    '#title' => t('Pass strength check'),
  );

  $form['pass_strength']['user_password_strength'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable password strength check'),
    '#default_value' => $config->get('password_strength'),
    '#description' => t('Enable password strength checking during account creation and modification.')
);

Suggested code:

  $form['pass_strength'] = array(
    '#type' => 'details',
    '#title' => t('Password strength check'),
  );

  $form['pass_strength']['user_password_strength'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable password strength check'),
    '#default_value' => $config->get('password_strength'),
    '#description' => t('Checks the strength of a password during account creation and modification.')
  );

user.settings.yml

  • Currently no default set
  • If you add password_strength: '1' the password check does not work in install - displays 'Password strength' and the line but no functionality works. Console also gives following error "DrupalBehaviorError: attach ; password: 'undefined' is not a function (evaluating 'passwordCheckMatch()')"

Tests

  • Only one test whereas appears in three places: install, create user & user edit
  • As per above, if you enable then try to install (say you were creating your own distro) it doesn't work.

user.js

  • passwordCheck wrapped in if, but further down on line 90 it calls passwordCheck when monitoring keyup and blur events

Disabled as default

  • The title of this issue is "Add option to disable password strength checking" but it seems decided along the way that it would be disabled by default. I believe this would result in many people not even knowing the functionality is there, and if it's part of Drupal then why disable by default, might as well go back to being a contrib. If in core, enable by default, the point of this issue was to make it easy to disable, default status should be a separate discussion.
dags’s picture

Assigned: Unassigned » dags

Thanks for the excellent review stevepurkiss.

user.admin.js
Agreed on all points but how about something like this for the description text: "Display password strength indicator during account creation and modification."

user.settings.yml
I'm investigating this issue.

Tests
Test can be added for the user edit page, but I don't believe there is any way to test the configuration form during installation.

user.js
Working on this as well.

Disabled as default
Totally agree with you. Enabled by default would also encourage the admin user to create a strong password during installation, which should be desired in most cases.

Anonymous’s picture

Hiya,

"Display password strength indicator during account creation and modification." sounds cool to me, although not sure how it affects referring to it as both password check/checker and indicator in text and code, should be one or the other rather than referring to both to cover all bases. I did look around for a Drupal glossary and found http://drupal.org/glossary but there doesn't seem to be different ones for different users so mostly technical, for example there's no mention of 'account' there but that seems to be the general term used, and your version explains it better.

So yes to your text, just thinking out loud ;)

Disable by default

Glad to hear you agree. May I suggest if those who disagree create a separate issue and link it here so we can discuss there and not hold this up further?

Cheers,

Steve

Anonymous’s picture

I have created a separate issue where the discussion can be continued with regards to disabling by default:

#1859298: Password strength check should be disabled by default

dags’s picture

Assigned: dags » Unassigned
Issue tags: -Novice
FileSize
8.11 KB
2.25 KB

Refactor user.js to address issue from #40 and adds another test for the user edit page. Also adding the 'refactor account workflow' tag at YesCT's request.

dags’s picture

Status: Needs work » Needs review
Anonymous’s picture

Hi @dags

This still doesn't work - did you test before posting? I've attached patch with your code plus the text changes we talked about earlier (I standardised on 'indicator' instead of using both 'check' and 'indicator' in the UI) and the interface issue (fieldset/details type), but the js is still broken.

Here's what the config screen looked like previously:
pass-strength-admin-old.png

Here's what it looks like now:
pass-strength-admin.png

Here's the error on account edit screen:
pass-strength-undefined.png

Here's the errors when you start typing:
pass-strength-undefined-errors.png

Here's the error during install if you disable:
pass-strength-undefined-install-errors.png

dags’s picture

Status: Needs work » Needs review
FileSize
2.96 KB
8.14 KB

It might be that your browser is caching an older version of the user.js file. If you're using Chrome, open up the Developer Tools and click the gear box in the bottom right. Check the 'Disable caching' box and retry the installation. I'm attaching another patch that also makes the text in the tests consistent.

Anonymous’s picture

Nope, I tested in Firefox, Chrome & Safari, cleared & disabled caches. When I looked at the code a few days ago I had the feeling the code was perhaps in the wrong place so stuff was getting fired off first before your code is reached, but I don't know enough about js to know for sure.

dags’s picture

Hmm it's working for me on Chrome 23.0.1271.95. I'll try to get in some more testing tomorrow.

Anonymous’s picture

I've fixed it, but it's not great due to the fact that the strength checker and password match functionality are intertwined.

You had removed your previous if statement in the js:

if (typeof settings.password.strengthTitle != 'undefined') {

So I put it back in before it adds any of the password meter html, and had to also put it in the passwordcheck function as the last thing that does is call the matching functionality, and the way they're attached to key-up and blur events I'm not really sure how to separate them out which it really needs doing, but, for the moment, it works ;) Would love a review ;)

YesCT’s picture

Issue tags: +Needs manual testing

@stevepurkiss good description of what you found and the change you made. please post an interdiff between 50 and 47 (interdiff-47-50.txt) that will help get review. :) And interdiffs are just a good habit.

YesCT’s picture

Issue tags: +Novice

there is some d.o tags bug... trying to add back tags.

Anonymous’s picture

@YesCT thanks and yes just learning about interdiffs - have attached what we've missed out so far since I've been on this thread.

dags’s picture

@stevepurkiss Your patch looks good. I don't know how that if statement slipped through but good catch. I'm posting another patch that addresses some other issues I found while testing. Some of this stuff might be better suited for separate issues and/or separate patches... but I'm going to post it here until someone yells at me.

First thing I did was move the 'Enable password strength indicator' checkbox inside the 'Registration and Cancellation' fieldgroup because I felt like it was undeserving of it's own.

Then I noticed a Javascript exception popping up while switching between the password and confirm inputs:
Uncaught TypeError: Cannot read property 'confirmClass' of undefined user.js:72

This is an existing issue not caused by our patch. It happens when there is a value in the confirmInput and focus returns to the passwordInput. I tracked the problem to an improper use of "this" in the passwordCheckMatch function in user.js:

var passwordCheckMatch = function () {

        if (confirmInput.val()) {
          var success = passwordInput.val() === confirmInput.val();

          // Show the confirm result.
          confirmResult.css({ visibility: 'visible' });

          // Remove the previous styling if any exists.
          if (this.confirmClass) {
            confirmChild.removeClass(this.confirmClass);
          }     

          // Fill in the success message and set the class accordingly.
          var confirmClass = success ? 'ok' : 'error';
          confirmChild.html(translate['confirm' + (success ? 'Success' : 'Failure')]).addClass(confirmClass);
          this.confirmClass = confirmClass;
        }     
        else {
          confirmResult.css({ visibility: 'hidden' });
        }     
      };    

So I refactored it:

var passwordCheckMatch = function (confirmInputVal) {
        var success = passwordInput.val() === confirmInputVal;
        var confirmClass = success ? 'ok' : 'error';

        // Fill in the success message and set the class accordingly.
        confirmChild.html(translate['confirm' + (success ? 'Success' : 'Failure')])
          .removeClass('ok error').addClass(confirmClass);
      }; 

It now takes 1 parameter and is only called at the end of passwordCheck function like so:

if (confirmInput.val()) {
          passwordCheckMatch(confirmInput.val());
          confirmResult.css({ visibility: 'visible' }); 
        }   
        else {
          confirmResult.css({ visibility: 'hidden' }); 
        }   

Now passwordCheckMatch only handles checking if the passwords match and passwordCheck determines if it should show the confirmResult div.

Finally I changed these two lines:

// Monitor keyup and blur events.
      // Blur must be used because a mouse paste does not trigger keyup.
      passwordInput.keyup(passwordCheck).focus(passwordCheck).blur(passwordCheck);
      confirmInput.keyup(passwordCheckMatch).blur(passwordCheckMatch);

to this:

// Monitor input events.
      $.each([passwordInput, confirmInput], function () {
        this.bind('input', passwordCheck);
      }); 

Blur doesn't actually catch paste events (at least on Chrome) as it was intended. A better option is to listen on 'input' and that will catch pastes and keyup - so no need to listen on blur or focus either. Most browsers should support the 'input' event but, I'm not sure if all the browsers that Drupal supports, support it.

I also made some minor text changes which you can see in the interdiff. This patch should fix a couple bugs and hopefully make the code more (and not less) readable.

dags’s picture

I forgot to mention that I added a new key to the $password_settings array called 'showStrengthIndicator' which gets converted to a true boolean value in Javascript so we don't have to check "typeof someSetting != 'undefined'". I thought this was cleaner and made the code more readable. There was a bug related to this in my last patch so here's a new one.

Anonymous’s picture

Just managed to grab some time to test, not looked at the code yet but the changes sound good!

First test I did was disable for install and that works fine, just the matching password check works (and better now when you change the first password as picks that up too as you said).

Second test was with it enabled and seems to work ok but the text is in the wrong position, it appears above the field. Not looked at the code to see why yet, thought I'd post a screenshot fyi while I do that.

password-strength-install.png

Anonymous’s picture

Status: Needs review » Needs work
edrupal’s picture

Tested following scenarious:

  1. Strength indicator enabled
  2. Strength indicator disabled

Tested on latest versions of following browsers (All on Windows 7), with Bartik theme:

  • Firefox
  • Internet Explorer
  • Safari
  • Chrome

All behaviour as expected.

With strength indicator enabled, indicator always showed as in attached screenshot

Password strength test screenshot

Anonymous’s picture

FileSize
117.72 KB
123.37 KB

Hi - this is during the install process not account editing. I just rebuilt a drupal 8 instance, applied the patch, made sure all browser caches cleared and here's the output:

install.png

install-type.png

Anonymous’s picture

Issue summary: View changes

Updated issue summary with remaining tasks to help people who might be new

edrupal’s picture

As a newbie introductory task I updated the issue summary to fit with the new template.

Merry Xmas

mrf’s picture

It seems a bit strange to not have this apply to the user edit screen as well.

If this is intentional and not an oversight, I would suggest re-naming the config to something more like 'registration_password_strength' to make that clear.

Anonymous’s picture

@mrf it does - it's just we're having issues with the display on the installer and as automated tests don't work on the installer I am manually testing hence lots of emails re the installer - sorry for any confusion!

eddourd’s picture

add this to ur template.php in theme folder

function themename_element_info_alter(&$types) {
  if (isset($types['password_confirm']['#process']) && (($position = array_search('user_form_process_password_confirm', $types['password_confirm']['#process'])) !== FALSE)) {
    unset($types['password_confirm']['#process'][$position]);
  }
}
Anonymous’s picture

After looking at this again I see the display issue is not actually to do with @dags work on the js side but something else that has changed in D8 whilst we've been working on this issue.

I have created a new issue to deal with that problem:

#1882474: Password strength indicator display broken in install process

Anonymous’s picture

Now that #1882474: Password strength indicator display broken in install process has been fixed (yay!) I've re-tested and re-rolled this patch, all looking great now thanks for all the help especially from @dags and @YesCT!

Feel free to review patch ;)

Anonymous’s picture

Status: Needs work » Needs review

Setting to 'needs review'.

Anonymous’s picture

YesCT’s picture

A new (and maybe bigger) before and after screenshot might help since the password strength checker is fixed.
Also, feel free to update the issue summary. :)

For example: Does this still need tests? I know it was mentioned earlier tests do not work for during the installer.

Anonymous’s picture

I've re-rolled to the latest 8 as things had moved since previous patch posted.

There are tests in the patch, none for install process as not poss afaik.

Wasn't sure what you meant by 'bigger' screenshots so got the whole screen. Have sized them down though as on retina display so they come out huge! Will update summary next.

Here's the install process normally, with password strength indicator enabled:

Here's the install process with password strength indicator disabled (i.e. after patch enabled and 'password_strength' in user.settings.yml is set to '0'):

Here's the account settings config screen before the patch applied:

Here's the account settings config screen after the patch applied (see new option under registration and cancellation section):

Here's the account edit screen after the patch applied and with the indicator disabled:

Here's the account edit screen with indicator enabled:

Anonymous’s picture

Issue summary: View changes

Update to issue summary to use standard template

Bojhan’s picture

This does not require a description.

Anonymous’s picture

Version attached without description line. Still not worked out how to easily do interdiffs yet (will do!) so just hazarding a guess that you can guess which one line I removed.

Screen shot of updated version without description:

YesCT’s picture

I do interdiffs by making a branch. then applying previous patch. then make a new branch, then make my new changes. then I can diff against the previous branch for an interdiff, and diff against 8.x for the patch.

like... http://xjm.drupalgardens.com/blog/interdiffs-how-make-them-and-why-they-...

I think for bigger screenshots, I meant to make the window smaller, so that when the screenshot is posted the text is more readable. Shoot for 600px wide or so on the window.

Anonymous’s picture

Thanks for the links, will check them out. Just found out mum's in hospital after suspected stroke so not top on my mind at the moment but saw this was an easy patch to update and didn't want to hold things up. Still so much to learn!!!

YesCT’s picture

@stevepurkiss no worries. no rush.

mgifford’s picture

chaloum’s picture

I've checked the patch #72 and it installs but does not work as expected
The images are as follows:

This is the before image of the config for the password strength settings

before config

And now the password strength is displaying as per normal and in accordance with the settings

Now the password strength setting is set for disable the password strength visual

Only local images are allowed.

But after setting the passwords strength to disabled the password strength visual still displays

I'm expecting the visual password strength not to display after it was disabled in the the settings.

YesCT’s picture

@chaloum, Thanks for doing those screenshots. Having before and after is helpful for comparison.

In what way did it not work as expected?

(also, it's totally ok, and helpful to inline the images. a img tag can be added by hand, or dreditor has a an "embed" link that makes it easy.)

chaloum’s picture

#78 YesCT I've changed my post #77. Hopefully the post is clearer.

simon.j.c’s picture

Checked patch at #72

Working as expected:
After applying the patch the Config at People's Accounts adds a check box "Enable password strength indicator".
Config people accounts after patch

Not working as expected:
In the User accounts area, the indicator still exists.
User Accounts page, after patch, still showing Password Strenght Indicator

YesCT’s picture

+++ b/core/modules/user/lib/Drupal/user/Tests/UserCreateTest.phpundefined
@@ -36,6 +36,17 @@ protected function testUserAdd() {
+    // Test that the password strength indicator displays.
+    $config = config('user.settings');
+
+    $config->set('password_strength', TRUE)->save();
+    $this->drupalGet('admin/people/create');
+    $this->assertRaw(t('Password strength:'), 'The password strength indicator is displayed.');
+
+    $config->set('password_strength', FALSE)->save();
+    $this->drupalGet('admin/people/create');
+    $this->assertNoRaw(t('Password strength:'), 'The password strength indicator is not displayed.');
+

hmm, the test passed last time it went to the testbot, and it's suppose to make sure the indicator is not shown. I wonder what is going on.

+++ b/core/modules/user/lib/Drupal/user/Tests/UserEditTest.phpundefined
@@ -76,6 +76,18 @@ function testUserEdit() {
+    $config->set('password_strength', FALSE)->save();

+++ b/core/modules/user/user.moduleundefined
@@ -2433,10 +2433,18 @@ function _user_mail_notify($op, $account, $langcode = NULL) {
+    'showStrengthIndicator' => FALSE,
...
+    $password_settings['showStrengthIndicator'] = TRUE;

I might need to look deeper , but why is it showStrengthIndicator in one spot, and password_strength in another?

+++ b/core/modules/user/user.jsundefined
@@ -23,70 +23,61 @@ Drupal.behaviors.password = {
+      // If the password strength indicator is enabled, add it's markup.

nit. it's is a contraction: it is. should be its markup

chaloum’s picture

Ran the test locally and all use tests passed locally, 1589 passes, 0 fails, 0 exceptions, and 440 debug messages

chaloum’s picture

Issue summary: View changes

updating status

inteja’s picture

Issue summary: View changes

Added steps to test

adammalone’s picture

Status: Needs review » Needs work
FileSize
8.21 KB

Currently the patch above causes the following to happen:

password_strength_broken.png

The reason the tests pass is because they look for the "Password Strength" text - however since it is 'undefined', tests think it's ok.

Perhaps it would be a lot easier to put the password strength checked into a form item and simply not output it if the box isn't ticked.

Anonymous’s picture

Status: Needs work » Needs review
FileSize
11.12 KB
155.51 KB

We did have an issue previously which was causing problems with the CSS but that was fixed: #1882474: Password strength indicator display broken in install process

I've just checked out the latest 8.x and it seems to work as expected for me when disabled:

I've re-rolled the patch as noticed a few lines were offset due to other changes.

mgifford’s picture

I can't seem to enable the "Enable password strength indicator" checkbox here admin/config/people/accounts

That should be enabled by default. I'd also like to see some security warning on this so that people are reminded that they should only disable this security reminder if they know what they are doing. For most sites this is a bad idea.

Anonymous’s picture

I can't seem to enable the "Enable password strength indicator" checkbox here admin/config/people/accounts

I've just checked it in a few different browsers (not that it should make any difference just being a form) on OSX and it's working fine - when you say you can't seem to enable it, could you elaborate? I haven't experienced any such issues.

That should be enabled by default.

It is enabled by default, although you can change that in user.settings.yml by changing password_strength: '1' to password_strength: '0'

I'd also like to see some security warning on this so that people are reminded that they should only disable this security reminder if they know what they are doing. For most sites this is a bad idea.

We did previously have a description however that was removed after Bojhan's comment "This does not require a description." #432962-71: Add option to disable password strength checking. I do tend to agree with you though, some kind of warning should be there. Do you have any ideas on text? Are there any standard formats for warning messages such as this?

YesCT’s picture

when I run into problems not being able to reproduce, I make sure I'm all clean, maybe by doing:

git stash
git checkout 8.x
sudo rm -r sites
git checkout sites
git pull --rebase

if things are really strange:
sudo rm -r drupal
git clone --recursive --branch 8.x http://git.drupal.org/project/drupal.git
(copy and pasted from http://drupal.org/project/drupal/git-instructions)

and then if I'm lucky and these work, then something like:
drush am 432962
(and if I'm not testing an install screen)
drush -y si --account-pass=admin --db-url="mysql://root:root@localhost/drupal" --site-name="disable checker 432962"
[edit added following 2 lines]
drush si drops the db tables, so if testing install, or just want to install by hand this is helpful to drop the tables before doing the install
drush -y sql-drop --db-url="mysql://root:root@localhost/drupal"

then, if things are still strange, I clear my browser cache (or do a shift refresh)

mgifford’s picture

Ok, I tried again and applied the patch in http://simplytest.me/project/drupal/8.x

So neat that you can do that. Anyways, it must have been because I was re-using an old DB with different variables.

Ok, so the code works!

The description that Bojhan objected to was:

Encourage users to create more secure passwords by displaying a password strength indicator during account creation and modification.

I was thinking of something like:

The security of your site and users could be put at risk if you disable this. Please ensure you know what you are doing before disabling this.

I don't think we have a security note or best practices pattern, but if we did:

Security Note: This feature gives some basic protection to see that your users have reasonable passwords. Only disable it if you are confident you've addressed these.

Or maybe even something like:

Advanced Options: You can disable this but doing so could make your site less secure.

How else does one let them know that this is any different than any of the other options?

mgifford’s picture

@YesCT - I like your list. That should go in a handbook note somewhere as I know I'd like to refer to it again and expect others could make use of that list too.

Anonymous’s picture

How about this - before:

after:

So at least we have the word "Security" mentioned twice in case anyone disables it then complains, we can refer them back to that fact ;)

Updated patch & interdiff attached.

mgifford’s picture

Works for me. @Bojhan?

mitron’s picture

Installed and manually tested. Works as expected.

chaloum’s picture

after following YesCT's comments #87 I can confirm the patch works as expected. When the "Enable password strength indicator" is checked the the visual indicator no longer displays when changing a users password

Bojhan’s picture

I really dont see a warning like this as being necessary. It tends to be really annoying when Drupal is points a warning finger at you, when you want to do something like this. I am sure most people who disable this will consciously decide to do this, its not like this is a super easy to find setting.

Anonymous’s picture

You have more faith in people than I must seem to have ;)

Personally I like it being there and don't find it offensive in any way and if it helps one person keep their site more secure then better in than out. A lot of people play with Drupal who don't know what they are doing so would prefer it there but not really bothered either way, just let me know if you need me to re-roll or do anything.

YesCT’s picture

I think we should do what Bojhan says.
displaying the strength indicator or not goes not actually make people pick more secure passwords. So I understand the intent, but I think we should reserve skip the description here.

adammalone’s picture

Agree with #94 & #96. A security warning like that makes it seem dangerous to disable. Similar messages are found on some of the Drupal core permissions which could actually present security risks to the site if applied incorrectly.

Perhaps just a descriptive message:
"When registering or changing password, users will see a guide indicating the password strength"

Anonymous’s picture

@YesCT your wish is always my command ;) Here's #84 renamed and retested against latest 8.x.

@typhonius - @Bojhan said description not needed #432962-71: Add option to disable password strength checking

YesCT’s picture

woo hoo!

now, this is the perfect situation for an interdiff, since the most recent change was a small one, and people have previously reviewed the patch. with an interdiff they can do a quick review and mark it rtbc. without the interdiff, they have to read through the whole patch looking for anything that might have accidentally changed. :)

Anonymous’s picture

FileSize
670 bytes

True, true. Interdiff attached. It'll be habit soon enough ;)

Welcome to comment #100!

adammalone’s picture

Status: Needs review » Reviewed & tested by the community

Tests pass - manual testing works for me - RTBC!

mgifford’s picture

Great. I updated the related patch here #1811240-19: Improve "password matches" and "password strength" accessibility to keep up.

shnark’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
905 bytes
11.12 KB

I did the change that YesCT recomended at the end of comment #81

mitron’s picture

Status: Needs review » Reviewed & tested by the community

Yes, it's great. Its pronoun is now correct. :)

Anonymous’s picture

Thanks @EllaTheHarpy I totally missed that!

catch’s picture

Assigned: Unassigned » Dries

Dries didn't like this first time around and I'm not completely sure myself. So giving him another chance to look at this before it goes in.

Anonymous’s picture

@catch Thanks for the update.

My 2p is the refactoring of code this patch performs decoupling the strength indicator from the password match is a Good Thing.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Changed my mind about this feature. I'm no longer opposed to it. Committed this to 8.x. Thanks for the persistance everyone.

YesCT’s picture

removing the separate task tags since this is fixed. :)

jibran’s picture

Title: Add option to disable password strength checking » Change notice: Add option to disable password strength checking
Assigned: Dries » Unassigned
Category: feature » task
Priority: Minor » Critical
Status: Fixed » Active
Issue tags: +Needs change record

I think we should have change notice for this. If not feel free to mark as fixed.

jibran’s picture

Issue summary: View changes

Fixed comment link

Gaelan’s picture

Status: Active » Needs review

Added change notice.

jibran’s picture

Title: Change notice: Add option to disable password strength checking » Add option to disable password strength checking
Category: task » feature
Priority: Critical » Minor
Status: Needs review » Fixed
Issue tags: -Needs change record

I think change notice looks good.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

echoz’s picture

Category: feature » bug
Status: Closed (fixed) » Needs review
Issue tags: -Novice, -refactor account workflow
FileSize
59.71 KB
59.7 KB
823 bytes

In #1864466: Password strength checker hidden on small screens in user.js we changed prepend to append to have the password strength indicator move below the password field on narrow viewports. The patch from this issue changed this instance of append back to prepend, thereby placing the password strength indicator above the password field (on narrow screens). This patch only changes it back, and in my testing, I can't see that it changes anything in this issue's feature, and it returns the other as it was intended.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

I checked and the follow-up does indeed restore the (new but) previous and correct behavior. Thanks!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 87163be and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nod_’s picture

Please tag your issues with "JavaScript" if a patch touches a JS file in any way. This patch reintroduced a bad use of $.each() that was fixed a year ago #2057371: Re-Replace all $.each() with filtered for loop.

Thank you.

nod_’s picture

Issue tags: +JavaScript

tag

nod_’s picture

Issue summary: View changes

correcting small spelling mistake