Identical switch case block in core/modules/user/user.js, need to merge this case with the identical block.

Comments

patil_kunal27 created an issue. See original summary.

Patil_kunal27’s picture

StatusFileSize
new313 bytes

Merged this case with the identical block.

Patil_kunal27’s picture

Status: Active » Needs review

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

lomo’s picture

Version: 8.4.x-dev » 8.3.x-dev
StatusFileSize
new0 bytes

I see what you are saying, @Patil_kunal27. And you are right, but if we look at the rest of the code, I think that the mistake here is that there is a 'case 4' in the switch at all.

The count of weaknesses (applied, after this to a strength factor based on the password length) is based on whether or not the password is missing any of four factors: lowercase (a-z), uppercase (A-Z), numbers (0-9), punctuation (any other character, at least by the definition this code is using). For each of these factors, the count of "weaknesses" is incremented (weaknesses is a variable initialized to 0 before this block).

So it appears that the mistake is really that we have a 'case 4' at all, since it should not be possible to enter a string of characters that don't have any of the four "character types". Even odd non-ASCII glyphs would fall into this code's definition of "punctuation", so a string containing all of the four "weaknesses" defined by the password strength-checking algorithm shouldn't be possible, as far as I can tell.

The changes this patch implies are so trivial (they don't affect the strength calculation at all), so I think this could still be applied to the current 8.3.x version of core without need for waiting till 8.4.x. That said, since it also makes no change to the outcome of the calculation, it also could wait. ;-)

I've attached a patch which simply removes the 'case 4' block from that switch statement. (And since I've done that, I guess I can't do what I was first hoping to do: mark this as RTBC... someone else will have to do that.)

lomo’s picture

StatusFileSize
new360 bytes

Typo making the patch and ended up making an empty file. (Oops.) This is the patch I meant to upload.

There really should be some way to immediately delete a mistakenly-uploaded .patch file (and remove it from the testing queue), just as we can edit our comments. ;-)

The last submitted patch, 5: 2819585-5.patch, failed testing.

lomo’s picture

Why does #7 refer to "the last submitted patch", when it was really "the patch before last"?

(And why does the system accept an empty patch file and trigger a test run? I cannot imagine that happens very often, but it should just be able to reject such a patch on attempted upload without blindly running all the tests, shouldn't it?)

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

paulocs’s picture

Category: Bug report » Task
Issue tags: +Bug Smash Initiative

I understand the point, but this issue is not a bug.

paulocs’s picture

Version: 8.9.x-dev » 9.3.x-dev

Bumping to 9.3.x

paulocs’s picture

StatusFileSize
new774 bytes
guilhermevp’s picture

Status: Needs review » Reviewed & tested by the community

All right! Moving to RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Drupal.evaluatePasswordStrength() does get called with passwords only consisting of spaces. They will then be trimmed to a 0 length string and fail all the text. In this instance weaknesses will equal 4 so I think we should go back to #2.

paulocs’s picture

Status: Needs work » Needs review
StatusFileSize
new508 bytes
new622 bytes

A new patch...

paulocs’s picture

StatusFileSize
new494 bytes
new654 bytes
marcusvsouza’s picture

Status: Needs review » Reviewed & tested by the community

RTBC!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 5b5988c8fa and pushed to 9.3.x. Thanks!

  • alexpott committed 5b5988c on 9.3.x
    Issue #2819585 by paulocs, LoMo, Patil_kunal27: Identical switch case...

Status: Fixed » Closed (fixed)

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