Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The colours for the password indicator is hardcoded in JS. Let's move it into CSS so it's easy for themes to override.
The classes used should follow our SMACSS-like conventions.
Comment | File | Size | Author |
---|---|---|---|
#2 | move-password-indicator-colors-into-css-2321167-2.patch | 2.72 KB | emma.maria |
Comments
Comment #1
emma.mariaComment #2
emma.mariaI added the different colour classes as states (is-weak etc) which are set based on the width of the indicator just as the hardcoded colours were originally.
I added a removeClass before the addClass to tidy up the classes in the markup and make sure only one is set at a time.
Screenshots
Comment #3
mgiffordWorks well on SimplyTest.me - http://s78da2e4c91252e2.s2.simplytest.me
Comment #4
mgiffordSome examples...
Comment #5
LewisNymanSeems like a good fix
I wonder if there is a better way of doing this. Let's see if JS people chime in.
Comment #6
tompagabor CreditAttribution: tompagabor commentedYes, there is a shorten way without jQuery.
Just change
to
Comment #7
emma.mariaSwitched out the jquery in favour of @tompagabor's solution and it works well, thanks for the suggestion!
Screenshot to show Strong only has one class and a CSS colour + patch
Comment #8
nod_I would rather not have unrelated class name hardcoded in the JS (because then we'll have to deal with it later on). Also #5/7 would remove any custom class on that element. Let's only deal with classes this script is responsible for.
#2 is RTBC. Not better way without handling the state and we really don't want to deal with state for a simple script like that.
Comment #9
alexpottCommitted #2 - 0d510d7 and pushed to 8.0.x. Thanks!
Comment #12
droplet CreditAttribution: droplet commentedso why do we hard-coded strength then ?