Problem/Motivation

The current password handling in Drupal is less user friendly. The users are supposed to enter the password twice. We need a password element with the feature to toggle whether to view the typed password, which then allows us to remove the requirement to enter the password twice.

Proposed resolution

We shall deprecate the old password element confirm_password and create a new password element with the ability to toggle to show password text.

Remaining tasks

User interface changes

Password field before patch:-
Before

Password field after patch:-
After

API changes

  1. Programmatic password submits for user create/update now require one value instead of 'pass1' and 'pass2' depending on config

Sign-offs needed

Please don't commit this without signoff from an accessibility maintainer - @mgifford or @andrewmacpherson

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Feature because usability improvement
Issue priority Not critical because usability improvement
Unfrozen changes Unfrozen because it only changes CSS/markup
Prioritized changes The main goal of this issue is usability
CommentFileSizeAuthor
#286 2293803-nr-bot.txt90 bytesneeds-review-queue-bot
#277 login_hover.png99.81 KBomkar.podey
#277 login.png112.77 KBomkar.podey
#276 2293803-nr-bot.txt13.48 KBneeds-review-queue-bot
#271 2293803-nr-bot.txt90 bytesneeds-review-queue-bot
#269 login_suggestions.jpg61.89 KBrkoller
#254 After.png313.92 KButkarsh_33
#254 Before.png302.19 KButkarsh_33
#246 Hide password state.png45.31 KButkarsh_33
#246 Show password state.png44.78 KButkarsh_33
#245 action-link-password.png17.96 KBckrina
#244 Reveal pass state.png441.32 KButkarsh_33
#244 Initial state.png465.22 KButkarsh_33
#241 Show password button.png34.15 KButkarsh_33
#240 look-like-link.png138.52 KBbnjmnm
#237 Password confirm updated.png370.54 KButkarsh_33
#234 issue.png148.16 KBnarendrar
#232 strength_suggestion_pre_patch.jpg32.83 KBrkoller
#232 strength_suggestion.jpg70.69 KBrkoller
#232 edge.jpg17.74 KBrkoller
#223 Show_password_allignment.png61.06 KButkarsh_33
#220 interdiff_219-220.txt502 bytesvsujeetkumar
#220 2293803-220.patch20.53 KBvsujeetkumar
#219 interdiff_215-219.txt1.2 KBvsujeetkumar
#219 2293803-219.patch20.53 KBvsujeetkumar
#218 wordpress.jpg21.99 KBrkoller
#218 typo3.jpg14.55 KBrkoller
#218 safari.jpg16.88 KBrkoller
#216 2293803-nr-bot.txt6.05 KBneeds-review-queue-bot
#215 2293803-215.patch20.62 KBgauravvvv
#210 interdiff-209_210.txt1.64 KBgauravvvv
#210 2293803-210.patch24.23 KBgauravvvv
#209 2293803-208.patch24.21 KBdaniel kulbe
#208 2293803-208.patch0 bytesdaniel kulbe
#203 interdiff_201-203.txt5.67 KBkostyashupenko
#203 2293803-203.patch24.18 KBkostyashupenko
#201 2293803-201.patch23.67 KBlendude
#201 interdiff-2293803-200-201.txt3.12 KBlendude
#200 2293803-200.patch23.96 KBlendude
#200 2293803-200.patch23.94 KBlendude
#196 2293803-edge-reveal-password-button.png17.92 KBandrewmacpherson
#196 2293803-edge-reveal-password-setting.png45.69 KBandrewmacpherson
#194 2293803-olivero-without-button-class.png40.26 KBsokru
#194 2293803-olivero-button-class.png42.01 KBsokru
#194 2293803-seven-button-class.png35.15 KBsokru
#191 interdiff_189_191.txt1.03 KBkishor_kolekar
#191 2293803-191.patch23.92 KBkishor_kolekar
#189 2293803-189.patch22.62 KBhardik_patel_12
#188 2293803-188.patch24.3 KBgeorge.karaivanov
#185 2293803-185.patch22.57 KBsokru
#183 interdiff_179-183.txt949 bytestarekdj
#183 2293803-183.patch22.8 KBtarekdj
#179 interdiff_176-179.txt22.67 KBchop
#179 2293803-179.patch22.79 KBchop
#176 interdiff-176.txt486 bytesamateescu
#176 2293803-176.patch20.71 KBamateescu
#174 interdiff-174.txt1.35 KBamateescu
#174 2293803-174.patch20.71 KBamateescu
#172 password-reveal-2293803-172.patch11.02 KBdaniel kulbe
#168 interdiff.txt2.89 KBlauriii
#168 2293803-168.patch20.68 KBlauriii
#165 interdiff-2293803-156-162.txt7.12 KBandrewmacpherson
#162 replace_confirm-2293803-162.patch11.49 KBmerauluka
#156 replace_confirm-2293803-156.patch19.02 KBvprocessor
#149 2293803-testing.pdf3.06 MBjludwig
#148 replace_confirm-2293803-148.patch19.37 KBjludwig
#147 replace_confirm-2293803-147.patch19.25 KBdagmar
#143 interdiff-2293803-141-143.txt3.22 KBdagmar
#143 replace_confirm-2293803-143.patch19.36 KBdagmar
#141 interdiff-2293803-136-141.txt4.7 KBdagmar
#141 replace_confirm-2293803-141.patch18.71 KBdagmar
#137 interdiff-122-136.txt1.04 KBBarisW
#136 replace_confirm-2293803-136.patch15.43 KBBarisW
#133 core-password-reveal-2293803-133.patch18.95 KBprashant.c
#128 core-password-reveal-2293803-127.patch10.96 KBprashant.c
#127 core-password-reveal-2293803-127.patch10.96 KBprashant.c
#127 interdiff-2293803-122-127.txt9 KBprashant.c
#125 bug.png506.84 KBAmruta_Nadgouda
#122 core-password-reveal-2293803-122.patch15.88 KBlendude
#122 interdiff-2293803-118-122.txt1.67 KBlendude
#118 core-password-reveal-2293803-118.patch15.39 KBlendude
#118 interdiff-2293803-116-118.txt3.49 KBlendude
#116 core-password-reveal-2293803-116.patch13 KBnod_
#116 interdiff.txt3.8 KBnod_
#115 password_reveal-2293803-115.patch12.38 KBlendude
#115 interdiff-2293803-113-115.txt950 byteslendude
#113 password_reveal-2293803-113.patch11.45 KBlendude
#113 interdiff-2293803-112-113.txt34.32 KBlendude
#112 interdiff.txt552 bytesleslieg
#112 issue-2293803-112.patch30.23 KBleslieg
#105 interdiff.txt1.48 KBlauriii
#105 replace_confirm-2293803-105.patch30.24 KBlauriii
#104 interdiff.txt326 bytesmallezie
#104 replace_confirm-2293803-104.patch29.94 KBmallezie
#103 interdiff.txt326 bytesmallezie
#103 replace_confirm-2293803-103.patch45.86 KBmallezie
#101 interdiff.txt2.21 KBmallezie
#101 replace_confirm-2293803-101.patch30.25 KBmallezie
#98 replace_confirm-2293803-98.patch29.63 KBjoelpittet
#98 interdiff.txt1.03 KBjoelpittet
#96 replace_confirm-2293803-96.patch29.4 KBjoelpittet
#96 interdiff.txt3.2 KBjoelpittet
#94 replace_confirm-2293803-94.patch32.45 KBjoelpittet
#94 interdiff.txt5.12 KBjoelpittet
#92 replace_confirm-2293803-92.patch25.76 KBlauriii
#86 Screen Shot 2015-04-21 at 10.31.17.png61.14 KBaspilicious
#86 Screen Shot 2015-04-21 at 10.31.06.png32.98 KBaspilicious
#86 Screen Shot 2015-04-21 at 10.29.29.png35.99 KBaspilicious
#86 Screen Shot 2015-04-21 at 10.29.16.png114.47 KBaspilicious
#80 interdiff.txt1.5 KBnod_
#80 core-password-reveal-2293803-80.patch26.03 KBnod_
#79 password-reveal.png269.29 KBmanjit.singh
#78 Screenshot 2015-04-16 15.21.22.jpg63.92 KBlewisnyman
#73 core-password-reveal-2293803-73.patch25.33 KBlendude
#69 core-password-reveal-2293803-69.patch25.3 KBlendude
#65 core-password-reveal-2293803-64.patch25.3 KBmanjit.singh
#61 show-password-rtl.png18.65 KBmanjit.singh
#61 show-password-ltr.png14.59 KBmanjit.singh
#61 core-password-reveal-2293803-61.patch24.21 KBmanjit.singh
#60 HiddenPassword.png12.65 KBmgifford
#60 VisiblePassword.png11.99 KBmgifford
#59 core-password-reveal-2293803-59.patch24.78 KBlendude
#57 core-password-reveal-2293803-57.patch24.4 KBlendude
#57 interdiff-2293803-55-57.txt697 byteslendude
#55 core-password-reveal-2293803-55.patch24.41 KBlendude
#53 core-password-reveal-2293803-53.patch24.4 KBnod_
#53 interdiff.txt6.89 KBnod_
#36 core-password-reveal-2293803-35.patch17.55 KBlendude
#33 core-password-reveal-2293803-33.patch17.47 KBmauzeh
#27 core-password-reveal-2293803-27.patch17.06 KBnod_
#25 core-password-reveal-2293803-25.patch15.97 KBnod_
#23 core-password-reveal-2293803-23.patch16.57 KBnod_
#22 password-toggle-issue-2293803-22.patch1.4 KBcorbacho
#17 password-toggle-issue-2293803-17.patch1.34 KBlewisnyman
#17 interdiff.txt2.52 KBlewisnyman
#10 Screen Shot 2014-07-31 at 16.57.26.png22.08 KBsqndr
#10 Screen Shot 2014-07-31 at 16.57.19.png20.32 KBsqndr
#10 password-toggle-issue-2293803-#10.patch1.71 KBsqndr
#6 show-password.png19.17 KBsqndr
#1 hackpad.com_4dSSBUhCYjj_p.95648_1403688322296_password.gif91.44 KBlewisnyman

Issue fork drupal-2293803

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lewisnyman’s picture

Bojhan’s picture

Title: Replace confirm password field with show/hide functionality » Add show/hide functionality to password field
Bojhan’s picture

Title: Add show/hide functionality to password field » Replace confirm password field with show/hide functionality
mgifford’s picture

It would be really cool if the Must contain values got crossed out as soon as you filled them in.

That being said, there will be a need to test this if we adopt this new pattern.

I notice in the example that the descriptive text is also above the input form. Would this rely on #314385: Make position of #description configurable via the API?

joachim’s picture

There's a contrib module that implements the show/hide password functionality: https://www.drupal.org/project/password_toggle

However, I don't think that removing the confirmation element is a good idea. Showing the password is a great usability improvement, but only if you are somewhere where you're not overlooked! If you're sitting in an office, or in a café, or doing a presentation, then you can't do that, so the confirmation element is necessary as a fallback.

sqndr’s picture

StatusFileSize
new19.17 KB

I have written an implementation for this (see Redesign password strength indicator so it's less fragile). Screenshot is attached (Bartik as admin theme). This 'show/hide' field is currently not inside the input element but outside (as you can see).

I think it's a good idea, especially on mobile. Having to type the same thing twice feels like a bad user experience to me. I've never really liked that. Anyway, even if we don't agree on that; I hope that we can agree that a show/hide field would be a nice improvement?

corbacho’s picture

I like the idea of the issue.

About #6, I like that implementation is outside of the box, so it doesn't conflict with LastPass, or other chrome extensions that put their stuff inside of password boxes

Also, notice that Internet Explorer 10 and 11, has this functionality already inside the password box:
http://www.askvg.com/how-to-disable-show-password-button-in-windows-8-wi...

sqndr’s picture

I'll try to post the patch here so we could experiment with this.

sqndr’s picture

Assigned: Unassigned » sqndr

I'll try to get this working again :)

sqndr’s picture

As a way to get started, I've included (copy/paste) the behavior from the password_toggle module.

Works that needs to be done with the javascript:
- Change the checkbox to a text/link (after the input field).
- Remove all the IE overhead that's currently in the behavior.

As soon as that part is working, we can start removing the confirm password field.

Bojhan’s picture

sqndr’s picture

@Bojhan: What do you mean? I was involved in that issue you're mentioning. In comment #36, this issue was created as a follow-up? That's why it's marked as a related issue ;-)

nod_’s picture

Status: Active » Needs work
Issue tags: +JavaScript

Please don't forget the JavaScript tag when working on JS issues :)

The JS needs work. We use .find explicitly instead of context selector, we only use .on, not the shortcut versions, Ideally we'd detect IE10+ and don't run this if the show password feature exists in the user's browser (hopefully we can detect this without sniffing…).

Basically, we can't just copy/paste the contrib JS here.

lewisnyman’s picture

Ideally we'd detect IE10+ and don't run this if the show password feature exists in the user's browser (hopefully we can detect this without sniffing…).

There seems to be very little documentation of this feature compared to the caps lock warning. It looks like we can style it using a pseudo selector so at least we can remove it so we don't have two showing up at the same time?

I'll work on this patch a little today.

sqndr’s picture

@_nod: Would it be okay to add a button and whenever the button is clicked, the password property changes: type = 'text';. Since we've dropped support for IE8, this could be a short solution? All browsers support changing the input field type, and IE8+ supports this as well.

The script would then:
- Check if the browsers already has show/hide password functionality. If not:
- Add a link (or button) after the input field with a text.
- Whenever the link is clicked: change the text (show - hide) / change the type (text - password).

Sorry 'bout the simple copy/paste. ;-)

nod_’s picture

If changing password input type isn't a problem anymore, that's cool with me. Simpler is better.

As for the detection it's too bad they give only the pseudo-element. I don't have IE around anymore so I can't check it out.

lewisnyman’s picture

Status: Needs work » Needs review
StatusFileSize
new2.52 KB
new1.34 KB

I rewrote the JS, posting it for review before I do any styling/design work.

nod_’s picture

quick question, do we want that on all password fields? including custom FAPI forms and all?

lewisnyman’s picture

hmm, the only use cases I can think of for password fields are logging in and setting your password. It feels correct to keep this functionality in the same place as password strength,

Bojhan’s picture

The screenshots arn't as subtle as in the OP. I am not sure the current direction makes sense.

sqndr’s picture

@Bojhan: The screenshots with the checkbox were just to demonstrate the way the contrib module handles with this. There's a new patch #19, were a button is added instead of a checkbox. This patch follows the image from the issue summary.
As said in #7, we are placing a button or text outside of the password field, to overcome issues with browsers extensions and IE.

corbacho’s picture

StatusFileSize
new1.4 KB

Reviewing the JS from #17, (nice work!) I saw that we could avoid querying the whole document twice (once for :password, another one for data-show-password-trigger)

Other fixes:
* Adding comment
* Adding $context = $(context) as I see is the pattern in other Drupal behaviors in core.
* Not creating the element showPassword unless is needed. (I was thinking to .clone() it if you don't like it inside of the closure)
* Moving the data-state="hidden" as part of the html string
* Name-space for the click event

Questions:
* should we just use parent() instead of .closest('.form-type-password') ? Which one should be more reliable ?
* Should we use an "a" element instead of "button" ?

Demo: http://jsfiddle.net/corbacho/6eQZX/

Sorry, no interdiff because output wasn't any useful.

nod_’s picture

StatusFileSize
new16.57 KB

Since we're talking about replacing the confirm with this button (no empty <a>) I removed the code related to the confirm functionality so if we're going this way we'll need a change notice.

Simplified the code a little. Rely on a data-drupal-revealpass attribute to do it's thing. Works pretty well so far.

We could probably create the button element from the PHP directly (in the form_process_password_confirm function) and add a "for" attribute or something so that we can do event delegation without relying on .parent() or .closest(). Anyway that's what I got so far.

Status: Needs review » Needs work

The last submitted patch, 23: core-password-reveal-2293803-23.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
StatusFileSize
new15.97 KB

fail fix.

Status: Needs review » Needs work

The last submitted patch, 25: core-password-reveal-2293803-25.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
StatusFileSize
new17.06 KB
mgifford’s picture

The order of the elements could present accessibility challenges like identified in #1811240: Improve "password matches" and "password strength" accessibility so just addign this as a related issue.

mgifford’s picture

Fun to run across this pattern here:
https://designpatterns.hackpad.com/Passwords-4dSSBUhCYjj

This is the hackpad for the UK Gov's https://www.gov.uk/service-manual/

Status: Needs review » Needs work

The last submitted patch, 27: core-password-reveal-2293803-27.patch, failed testing.

mgifford’s picture

Issue tags: +Needs reroll
mauzeh’s picture

StatusFileSize
new17.47 KB

Posting a reroll against 64de978a08663904ba8231f20d2f26c8f5a135e8 @ 8.0.x.

nod_’s picture

There are coding standard issues, Tabs are used in some places, it should be 2 spaces.

mgifford’s picture

StatusFileSize
new99.55 KB

It's neat to see this pattern. The input form needs a label. It's fine to have that label be invisible, but screen readers need to have it announced to them what the form is.

That being said, it's better laid out for screen readers, so think it's something that will a big usability & accessibility improvement when we get it in.

lendude’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: +Amsterdam2014
StatusFileSize
new17.55 KB

Removed the coding standard issues.

Moving this forward has a couple of issues, changed the Issue summary to reflect these issue (API changes).

  1. This restructures the DOM around a rendered password_confirm field. This breaks the handling of the password_confrm DOM in the user module (user.js) It expects a certain layout to attach password strength and password hint elements. (and possibly affects other modules)
  2. This breaks drush install because it expect a pass1 and pass2 field for setting admin password
  3. All password_confirm elements would now require a #title to be set in the form definition. In the original version a title was set when splitting the element into two fields, so no titles are currently set by modules using password_confirm

In view of these issues it seems unlikely that this can still be added to D8 and should maybe be moved to contrib.

Marking this as 'needs review' to run the testbot, but this still needs work.

Status: Needs review » Needs work

The last submitted patch, 36: core-password-reveal-2293803-35.patch, failed testing.

BarisW’s picture

This looks sweet!

We could re-use some of the JS/CSS from #1811240: Improve "password matches" and "password strength" accessibility. And add Drupal.announce too.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 36: core-password-reveal-2293803-35.patch, failed testing.

Status: Needs work » Needs review

The last submitted patch, 33: core-password-reveal-2293803-33.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 36: core-password-reveal-2293803-35.patch, failed testing.

emma.maria’s picture

Issue tags: -Needs reroll

Status: Needs work » Needs review
lewisnyman’s picture

Status: Needs review » Needs work

Setting to 'needs work' based on the comments in #36. Surprised it passes tests.

sqndr’s picture

Status: Needs work » Postponed

Reading #36, I feel like this is to late to add this functionality to Drupal 8. Any other thoughts? Marking as postponed meanwhile.

mgifford’s picture

Issue tags: +Needs reroll

This needs a reroll again. I would say this would be a pretty damn cool feature to bring into D8, but I have a hard time not seeing it as a feature. In which case we could bump it to 8.1.

Any other thoughts?

lewisnyman’s picture

Sounds like a good call

lewisnyman’s picture

Version: 8.0.x-dev » 8.1.x-dev
sqndr’s picture

+++ b/core/misc/revealpass.js
@@ -0,0 +1,38 @@
\ No newline at end of file

Small issue ;) I'll try to look into the rest of the patch again later today.

corbacho’s picture

Issue summary: View changes
Issue tags: -Amsterdam2014

Luke has published a new interesting research
Showing Passwords on Log-In Screens http://www.lukew.com/ff/entry.asp?1941

nod_’s picture

Status: Postponed » Needs review
Issue tags: -Needs reroll
StatusFileSize
new6.89 KB
new24.4 KB

Rerolled #36, 1) and 3) are taken care of, about 2) and drush, they're releasing same time as D8 betas so it shouldn't be a huge issue. NR for testbot.

Status: Needs review » Needs work

The last submitted patch, 53: core-password-reveal-2293803-53.patch, failed testing.

lendude’s picture

Version: 8.1.x-dev » 8.0.x-dev
Status: Needs work » Needs review
StatusFileSize
new24.41 KB

Rerolled #53 for #2348321: Upgrade to jQuery Once 2.x

Set issue to the right version so patch gets applied to 8.0.x

One more thing I'd like to add to my list in #36:
4. Name of the form element should be changed to something else then 'password confirm', because that is no longer what this field does. 'password reveal' or something along those lines? Or should we keep the name for ease of migration....

Let's see if this applies...

Status: Needs review » Needs work

The last submitted patch, 55: core-password-reveal-2293803-55.patch, failed testing.

lendude’s picture

Status: Needs work » Needs review
StatusFileSize
new697 bytes
new24.4 KB

Hopefully this fixes most of the fails...

nod_’s picture

Sweet, good to go for me. Let's hope someone can RTBC this.

Need to ping drush maintainers and check what needs to be done on that end.

lendude’s picture

StatusFileSize
new24.78 KB

Bit of nitpicking...

+++ b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php
@@ -177,6 +177,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
diff --git a/core/lib/Drupal/Core/Render/Element/PasswordConfirm.php b/core/lib/Drupal/Core/Render/Element/PasswordConfirm.php

Docblocks needed to be updated.

mgifford’s picture

Issue summary: View changes
StatusFileSize
new11.99 KB
new12.65 KB

Some screenshots from the last patch. Would be so nice to have this in D8.

manjit.singh’s picture

StatusFileSize
new24.21 KB
new14.59 KB
new18.65 KB

Looking good for me !!!
Some screenshots from #59 patch !!

Also Button link is collapsed with password input field in LTR and RTL, So Adding some margin for link button :)

.password-parent button.link {
  margin: 0 10px;
}

Status: Needs review » Needs work

The last submitted patch, 61: core-password-reveal-2293803-61.patch, failed testing.

nod_’s picture

Patch is missing the revealpass.js file.

Also we can't rely on password-parent class to style revealpass because it's a class added by the user module and we don't want to tie this feature to user module. We need some CSS help, don't like using px much for this, ideally we'd add the space inside the CSS with before and content or something. Like we did for admin links (the edit in machine name).

We need to add a span around that button to add the space in CSS. Need to have someone tell us which name we should give the class on the span.

manjit.singh’s picture

Adding revealpass.js in patch.

replaced px with em

.password-parent button.link {
 margin: 0 0.75em;
}

@nod_ Would form-type-password-confirm Or form-item-pass work ? rather than password-parent.

manjit.singh’s picture

StatusFileSize
new25.3 KB

forget to attach patch :)

lendude’s picture

Status: Needs work » Needs review

Lets kick the testbot into action....

Status: Needs review » Needs work

The last submitted patch, 65: core-password-reveal-2293803-64.patch, failed testing.

lendude’s picture

Status: Needs work » Needs review
StatusFileSize
new25.3 KB

Status: Needs review » Needs work

The last submitted patch, 69: core-password-reveal-2293803-69.patch, failed testing.

nod_’s picture

Issue tags: +Need reroll
lendude’s picture

Issue tags: -Need reroll
StatusFileSize
new25.33 KB

Rerolled.

lendude’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 73: core-password-reveal-2293803-73.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 73: core-password-reveal-2293803-73.patch, failed testing.

lewisnyman’s picture

Issue summary: View changes
StatusFileSize
new63.92 KB

Nice work everyone! I think that we are almost there, I noticed that we still have the desktop styling once the show password link wraps so it still looks indented. We need a min-width media query around that styling.

+++ b/core/modules/system/css/system.theme.css
@@ -179,6 +179,9 @@ abbr.ajax-changed {
+.password-parent button.link {
+  margin: 0 0.75em;
+}

Also this selector is wrong, we should add a new class called .toggle-password.

manjit.singh’s picture

StatusFileSize
new269.29 KB

@lewisnyman Found some issue on installation screen.

  1. margin is not consistent of the link. (Show password / Hide password)
  2. undefined text under password feild

These issues are only on installation screen, Please find screenshot.

nod_’s picture

Status: Needs work » Needs review
StatusFileSize
new26.03 KB
new1.5 KB

We missed a place, changed it let's see how it goes.
didn't touch the style.

manjit.singh’s picture

Seems like issues are still there ? Can you Please check the screenshot and comment posted in #79.

lendude’s picture

@nod_ you found it first :-) Nice one.

@Manjit.Singh can't reproduce the issues you show in #79 with the patch in #80 in Safari or Chrome, what browser are you using?

manjit.singh’s picture

Found this issue in chrome while installing new site.

Steps to reproduce.

  1. Install site from scratch.
  2. when you came across Configure sitepage just apply patch #80.
  3. Clear cache from database manually.
  4. Refresh Configure site page.

I have done these steps and facing this issue. Can you please try it at your end. Hopefully you will get same issue.

lendude’s picture

@Manjit.Singh nope, still just works for me. Can you try patching first and then doing the install from the beginning, that is after all how it will work in the end.

droplet’s picture

It will cause Password Manager doesn't work.

aspilicious’s picture

Status: Needs review » Needs work
StatusFileSize
new114.47 KB
new35.99 KB
new32.98 KB
new61.14 KB

Needs a bit of polishing. Can someone please finish this awesome patch? Would make every dev his live less miserable who has to deal with UX designers ;)

I attached some screenshots to show that it sometimes brakes a bit on different screen sizes.
I tried the installer and the user/edit page.

#78 has some starting instructions.

aspilicious’s picture

+ // @todo remove element?

And we need to take care of this.

The last submitted patch, 80: core-password-reveal-2293803-80.patch, failed testing.

lewisnyman’s picture

Version: 8.0.x-dev » 8.1.x-dev
Status: Needs work » Postponed

We should be able to add this behind an experimental module/checkbox in 8.1, it would be great to have this option.

mgifford’s picture

Status: Postponed » Needs review
lauriii’s picture

StatusFileSize
new25.76 KB

Rerolled the latest patch

Status: Needs review » Needs work

The last submitted patch, 92: replace_confirm-2293803-92.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
StatusFileSize
new5.12 KB
new32.45 KB

Removed some more pass1/pass2 references that have snuck in and the Confirm test.

Status: Needs review » Needs work

The last submitted patch, 94: replace_confirm-2293803-94.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
StatusFileSize
new3.2 KB
new29.4 KB

Not sure where that extra file came from.

joelpittet’s picture

Status: Needs review » Needs work

So passes tests:) but the strength indicator seems to be gone at the moment.

joelpittet’s picture

Status: Needs work » Needs review
StatusFileSize
new1.03 KB
new29.63 KB

Oh that was easy, hopefully I attached it in the right place

lendude’s picture

Status: Needs review » Needs work

Nice to see this moving again!

  1. Missed a spot in stable theme to remove .password-confirm-match styling.
  2. Issues raised in #78, #86 and #87 still need to be addressed (tested it and those issues still exist)
  3. +++ b/core/lib/Drupal/Core/Render/Element/PasswordConfirm.php
    @@ -28,94 +27,26 @@
    +class PasswordConfirm extends Password {
    

    We should really rename the element to something like PasswordReveal (and change all references in classes and such from confirm to reveal), the current naming makes little sense except from a BC stand point I feel. But maybe that should be a follow up (cause I realise that would make this a much bigger change)?

Manually tested this in Bartik, Seven, Stark and during install and the reveal works and password strength and hints show up in all.

lauriii’s picture

#99.3: We could create new class called PasswordReveal and PasswordConfirm would extend that. How ever we cannot change our existing usages to use that new element since we have to maintain BC.

mallezie’s picture

Status: Needs work » Needs review
StatusFileSize
new30.25 KB
new2.21 KB

Removed the leftover comfirm selector
Added media query for margin
changed selector to new class
removed element in test

lendude’s picture

Status: Needs review » Needs work
+++ b/sites/development.services.yml
@@ -5,3 +5,6 @@
+parameters:
+  twig.config:
+    debug: true
 

this snuck into the patch

mallezie’s picture

Status: Needs work » Needs review
StatusFileSize
new45.86 KB
new326 bytes

Oops.

mallezie’s picture

StatusFileSize
new29.94 KB
new326 bytes

And oops again, that last patch is incorrect, hence the 15KB growth.

lauriii’s picture

StatusFileSize
new30.24 KB
new1.48 KB

Fixed some eslint warnings caused by the new JavaScript.

chuchunaku’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +SprintWeekend2016, +SprintWeekendBOS

I applied patch replace_confirm-2293803-105.patch locally on a clean Drupal install and was able to test the hide password / show password functionality without receiving any errors. I tested the patch by running drush uli to generate a link to create a new password. I then entered the new password and clicked the show password / hide password link.

droplet’s picture

Status: Reviewed & tested by the community » Needs review
  1. +++ b/core/misc/revealpass.js
    @@ -0,0 +1,51 @@
    +          var $trigger = $('<button type="button" class="link toggle-password">' + showPass + '</button>');
    

    we should not loop this inside each.

  2. +++ b/core/misc/revealpass.js
    @@ -0,0 +1,51 @@
    +          $trigger.on('click', {password: element}, revealClickHandle);
    +          $trigger.insertAfter(element);
    

    IMO, it should be init from revealClickHandle function and provide a way to override default actions.

nod_’s picture

The script is pretty simple, I would expect people to override Drupal.behaviors.revealPass if they want override the behavior.

They can still register a delegated event listener is they want to do something on the click.

lauriii’s picture

Status: Needs review » Needs work

The #107.1 makes sense but could you please elaborate #107.2 since it's over my head :)

Edit: Cross posted with nod_. Anyway if that is wanted to be done, I need some more help to get it done!

David_Rothstein’s picture

- * Formats as a pair of password fields, which do not validate unless the two
- * entered passwords match.
+ * Password form element has hidden text that may be revealed by the user.
  *
  * Usage example:
  * @code
@@ -28,94 +27,26 @@
  *
  * @FormElement("password_confirm")
  */
-class PasswordConfirm extends FormElement {
+class PasswordConfirm extends Password {

Why is this called "PasswordConfirm" if it doesn't involve confirming the password?

And related to that, why is it modifying the existing PHP class + form element rather than creating a new one, called e.g. PasswordReveal?

#99 raised some of the above points as well.

See also #90 - for backwards compatibility shouldn't this be an opt-in feature (not necessarily a new module, but opt-in for existing sites in some way)?

joelpittet’s picture

+++ b/core/misc/revealpass.js
@@ -21,16 +32,20 @@
+        .each(function revealLink(index, element) {

This should be an anonymous function when it was moved in the each() in #105

leslieg’s picture

StatusFileSize
new30.23 KB
new552 bytes

As part of SprintWeekend2016 Chuchunaku and I re-rolled the patch using the comment in #111. Other questions remain in comment #110.

lendude’s picture

Status: Needs work » Needs review
StatusFileSize
new34.32 KB
new11.45 KB

So, rewrite per #90, #99 and #110.

Don't replace the current confirm functionality but add a new element and allow sites to opt-in using it on user edit pages.

Since it's an opt-in after install, it won't be used on the install pages (so no breaking of drush).

The new element would still need tests if this is the direction we want to take this.

Did some manual testing and the strength indicator and hints show up and in the right place as far as I could tell.

Status: Needs review » Needs work

The last submitted patch, 113: password_reveal-2293803-113.patch, failed testing.

lendude’s picture

Status: Needs work » Needs review
StatusFileSize
new950 bytes
new12.38 KB

Think this should fix most (all?) of the fails.

nod_’s picture

StatusFileSize
new3.8 KB
new13 KB

Few things slipped from the last time I checked. All good on my end now.

swentel’s picture

Looks very sweet!

I think we'll probably need an update hook in user.install to set the property in user.settings - but not 100% sure though.
(note: if it does, I think an upgrade path test would be very much over the top though)

lendude’s picture

Thanks for the great JS rewrite @nod_!

Didn't look into #117, but thanks for pointing that out @swentel. I have no idea if this is needed. If somebody knows, let us know!

Added some tests for the new element and for using it in the user edit form. Plus removed some residual confirm references in reveal.

andypost’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests, +D8 upgrade path
Related issues: +#2227381: Apply formatters and widgets to User base fields 'name' and 'email'

Great to see that configurable, otoh looking on that from entity api side (see related) that should be configurable with widget.
Also introduction of new setting should have upgrade for existing sites and covered with tests

+++ b/core/modules/user/src/AccountSettingsForm.php
@@ -170,6 +170,11 @@ public function buildForm(array $form, FormStateInterface $form_state) {
+    $form['registration_cancellation']['user_password_type_reveal'] = array(
...
+      '#default_value' => $config->get('password_type_reveal'),

this needs upgrade path with test

dawehner’s picture

  1. +++ b/core/lib/Drupal/Core/Render/Element/PasswordReveal.php
    @@ -0,0 +1,55 @@
    +    $info['#process'][] = [get_class($this), 'processPasswordReveal'];
    

    Note: you can replace get_class($this) by static::class.

  2. +++ b/core/lib/Drupal/Core/Render/Element/PasswordReveal.php
    @@ -0,0 +1,55 @@
    +    $element['#attributes']['class'][] = 'password-field';
    +    $element['#attributes']['class'][] = 'js-password-field';
    

    I'm curious, is this something we could do in a template layer or does our JS require those classes?

  3. +++ b/core/misc/revealpass.js
    index 8372ccd..7e12609 100644
    --- a/core/modules/user/config/install/user.settings.yml
    
    --- a/core/modules/user/config/install/user.settings.yml
    +++ b/core/modules/user/config/install/user.settings.yml
    
    +++ b/core/modules/user/config/install/user.settings.yml
    +++ b/core/modules/user/config/install/user.settings.yml
    @@ -13,4 +13,5 @@ register: visitors
    
    @@ -13,4 +13,5 @@ register: visitors
     cancel_method: user_cancel_block
     password_reset_timeout: 86400
     password_strength: true
    +password_type_reveal: false
     langcode: en
    diff --git a/core/modules/user/config/schema/user.schema.yml b/core/modules/user/config/schema/user.schema.yml
    
    diff --git a/core/modules/user/config/schema/user.schema.yml b/core/modules/user/config/schema/user.schema.yml
    index 627d8a6..81f224b 100644
    
    index 627d8a6..81f224b 100644
    --- a/core/modules/user/config/schema/user.schema.yml
    
    --- a/core/modules/user/config/schema/user.schema.yml
    +++ b/core/modules/user/config/schema/user.schema.yml
    
    +++ b/core/modules/user/config/schema/user.schema.yml
    +++ b/core/modules/user/config/schema/user.schema.yml
    @@ -50,6 +50,9 @@ user.settings:
    
    @@ -50,6 +50,9 @@ user.settings:
         password_strength:
           type: boolean
           label: 'Enable password strength indicator'
    +    password_type_reveal:
    +      type: boolean
    +      label: 'Use password reveal on account edit page'
     
     user.mail:
    

    We need an update hook for that

  4. +++ b/core/modules/user/src/Tests/UserEditTest.php
    @@ -106,6 +106,19 @@ function testUserEdit() {
    +
    +    // Test editing the user with a password_reveal field.
    +    $config->set('password_type_reveal', TRUE)->save();
    +    $config->set('password_strength', TRUE)->save();
    +
    +    $this->drupalGet("user/" . $admin_user->id() . "/edit");
    +    $this->assertRaw('Password strength:', 'The password strength indicator is displayed.');
    +
    +    $edit = array();
    +    $edit['pass'] = $this->randomMachineName();
    +    $edit['current_pass'] = $admin_user->pass_raw;
    +    $this->drupalPostForm("user/" . $admin_user->id() . "/edit", $edit, t('Save'));
    +    $this->assertRaw(t("The changes have been saved."));
    

    Isn't type_reveal the default now, so we should also add a test which tests the other case?

chx’s picture

Thanks so much! Looks really great. A few small tidbits.

$info['#process'][] = [get_class($this), 'processPasswordReveal'];

Now Drupal 8 went with PHP 5.5 so you can just do (check https://3v4l.org/1HEea)

$info['#process'][] = [static::class, 'processPasswordReveal'];
+    $element['#attached']['library'][] = 'core/drupal.revealpass';

Can we move this up a few lines as it's looking rather odd in the middle of #attributes modifications?

Finally, the issue summary needs an update as the API changes listed say "Programmatic password_confirm submits now require one value instead of 'pass1' and 'pass2'" but it seems this is now config dependent.

lendude’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -D8 upgrade path, -Needs issue summary update
StatusFileSize
new1.67 KB
new15.88 KB

Thanks for the great feedback all.

Updated the issue summary per @chx

I'm not to clear on the whole update path (let alone a test for it), so took a stab at it, but you might be referring to something else.

120.2 Yeah the JS uses those classes.
120.4 Currently type_reveal = FALSE as a default, so I don't think we need any tests for that (all user edit tests are run with that setting, so that should be enough right?)

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

pixelmord’s picture

Added relationship to #1259892

Users could not find the Change password fields

Amruta_Nadgouda’s picture

Status: Needs review » Needs work
StatusFileSize
new506.84 KB

bug

Bug : If i try to apply a patch then the existing functionality of 'password match' is not working.

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

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

prashant.c’s picture

Status: Needs work » Needs review
StatusFileSize
new9 KB
new10.96 KB

Fixing confirmed password status issue.

prashant.c’s picture

StatusFileSize
new10.96 KB

Adding the correct patch file.

lendude’s picture

@Prashant.c thanks for looking at this! The patch seems to be missing all the new files from #122

And since we now have javascript testing, this should get some javascript tests. And the update path also still needs a test.

The last submitted patch, 127: core-password-reveal-2293803-127.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 128: core-password-reveal-2293803-127.patch, failed testing.

manjit.singh’s picture

@Prashant.c The only change that i found in the latest patch is in /core/modules/user/user.js except the missing files.
Can you please create a fresh patch with your changes ?

prashant.c’s picture

Status: Needs work » Needs review
StatusFileSize
new18.95 KB

@Lendude , @Manjit.Singh
Thanks, made the suggested changes into the new patch file, same needs to be reviewed.

Status: Needs review » Needs work

The last submitted patch, 133: core-password-reveal-2293803-133.patch, failed testing.

manjit.singh’s picture

this seems like not created with current head :( fails to apply.
Also please attach interdiff also in future. It help reviewers.

BarisW’s picture

Status: Needs work » Needs review
StatusFileSize
new15.43 KB

Here is a re-roll.

BarisW’s picture

StatusFileSize
new1.04 KB

And here is the interdiff

BarisW’s picture

Issue tags: +Dublin2016
lendude’s picture

@BarisW thanks for the reroll! Manually tested this again and still works.

Bit of nitpicking:

+++ b/core/lib/Drupal/Core/Render/Element/PasswordReveal.php
@@ -0,0 +1,55 @@
+/**
+ * @file
+ * Contains \Drupal\Core\Render\Element\PasswordConfirm.
+ */

this needs to go

+++ b/core/modules/user/user.module
@@ -1271,6 +1274,44 @@ function user_form_process_password_confirm($element) {
+ * elements to add the JavaScript and string translations for dynamic password
+ * validation.

The copy/paste 'dynamic password validation' comment probably needs a change.

And we still need a Javascript test for this. Setting to needs work mostly for the javascript test.

lendude’s picture

Status: Needs review » Needs work

Like I said, needs work...

dagmar’s picture

Status: Needs work » Needs review
StatusFileSize
new18.71 KB
new4.7 KB

Added Js tests and fixed comments from #139.

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.

dagmar’s picture

This new patch checks that two reveal_passwords fields can work together.

dagmar’s picture

Status: Needs review » Needs work
dagmar’s picture

Status: Needs work » Needs review

Hm, after reading #2851541: [policy, no patch] No new WebTestBase tests in Drupal 8 after mass-conversion...

If a WTB already exists, and additional coverage is appropriate in that class, then add in new tests methods or assertions as needed

It seems we don't need a modification of the patch. Because the WebTestBase already exists in the user module. Back to NR.

The last submitted patch, 112: issue-2293803-112.patch, failed testing.

dagmar’s picture

StatusFileSize
new19.25 KB

Rerolled after array > [] conversion. As an interesting note, I used the php-short-array-syntax-converter like other devs are doing but for this particular patch, some ); need to be converted by hand.

jludwig’s picture

StatusFileSize
new19.37 KB

I re-rolled the patch because it wasn't applying cleanly anymore. I also fixed 3 minor coding style issues:

core/misc/revealpass.js
33	Missing JSDoc parameter description for 'element'. (valid-jsdoc)
33	Missing JSDoc parameter description for 'index'. (valid-jsdoc)
core/tests/Drupal/Tests/Core/Render/Element/PasswordRevealTest.php
3	Namespaced classes, interfaces and traits should not begin with a file doc comment

Currently testing the patch and doing some further code review.

jludwig’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new3.06 MB

It works very well. I didn't provide text saying what's going on in the attached PDF, but it basically goes through the whole process: running update.php, configuring it on, testing it out, logging on to make sure it works, then changing it back.

yoroy’s picture

Status: Reviewed & tested by the community » Needs review

What is the reason to make this an optional setting instead of the new default? I wonder why core itself should provide two different ways of handling this.

andypost’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

Making such change require strong reasons in issue summary.

There's no agreement on usability reasons, at least they not explained in comments!

new form element introduced, but why it's not integrated to existing?

I pointed #2227381: Apply formatters and widgets to User base fields 'name' and 'email' and I'm sure proper widget is a way to go.
but what about install form and tests that supposes there should be 2 fields (all over contrib).
And it requre product manager review + maybe postpone til 8.5

nod_’s picture

but what about install form and tests that supposes there should be 2 fields (all over contrib).

If I remember right that was the reason why it was not set as default. At least it broke drush, probably other things.

( edit ) also, 3 years ago. time flies.

aspilicious’s picture

Existing sites that are "themed" could be ugly if we swap the password widget. But we could/should enforce it for new installs and deprecate the old widget.

droplet’s picture

It broke the PasswordManager #85.

By the way,

Why the ref articles talk about LOGIN SCREEN, but here used in a Change Password screen. Does it correct?

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

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now 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.

vprocessor’s picture

Status: Needs work » Needs review
StatusFileSize
new19.02 KB

Just reroll of #148 for core version 8.5.x

vprocessor’s picture

Status: Needs review » Reviewed & tested by the community

I checked this patch on real projects, patch works good for me

cilefen’s picture

Status: Reviewed & tested by the community » Needs review

Thank you for rerolling @vprocessor. We need peer review on this and as per #151 it needs work.

cilefen’s picture

Status: Needs review » Needs work

whoops

Christopher Riley’s picture

Although the patch works within the change password area the functionality that I believe was desired is the ability to do a reveal password on the login page so that the user can see what they are typing in. Lord knows there are enough uneducated users out there that don't remember the caps lock.

My two cents

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

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now 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.

merauluka’s picture

Status: Needs work » Needs review
StatusFileSize
new11.49 KB

I could see the usefulness of allowing people to turn the strength indicator on and off in certain instances. Here's an updated version of #156 but allowing the data-drupal-password-strength value to be set at the form level and passed on through to JS.

Status: Needs review » Needs work

The last submitted patch, 162: replace_confirm-2293803-162.patch, failed testing. View results

andrewmacpherson’s picture

Issue summary: View changes
Issue tags: +Needs accessibility review

I think this one should require an accessibility maintainer's sign-off before committing. @mgifford and I are both following this. I like the ideas here though, it would be good to have this.

Is this just about replacing the dual-field widget for creating passwords (profile edit, site installation) or will this be used on the user login form?

Depending how it gets implemented, there are potential security issues that impact visually impaired users. If a screen reader announces it as a password field, users may assume what they type is masked out, and be unaware that it's on screen and readable over their shoulder. And vice versa, it may be visually masked out, and a screen reader announces the keys being pressed.

andrewmacpherson’s picture

Issue tags: +Needs reroll
StatusFileSize
new7.12 KB

I think patch #162 lost some stuff from #156 that is still needed. It no longer has the JS function revealClickHandle(), for example. I'm attaching an interdiff for someone else to do a re-roll.

andrewmacpherson’s picture

I went scanning though the patches for important semantics like role or type attributes. I can see the approach of revealClickHandle() in #156 is toggling between <input type="text"> and <input type="password">. That's good to see, and is probably sufficient to answer the security concern I put in #164. I had been worried by some approaches I'd heard about where a text field is laid on top of a password field using CSS. I'll do some manual accessibility testing on this soon hopefully.

andypost’s picture

  1. +++ b/core/modules/user/config/schema/user.schema.yml
    @@ -50,6 +50,9 @@ user.settings:
    +      label: 'Use password reveal on account edit page'
    

    why only on user edit? register/login could use it as well

  2. +++ b/core/modules/user/src/AccountForm.php
    @@ -109,11 +109,21 @@ public function form(array $form, FormStateInterface $form_state) {
    +      if ($config->get('password_type_reveal')) {
    ...
    +          '#type' => 'password_reveal',
    ...
    +      else {
    ...
    +          '#type' => 'password_confirm',
    
    @@ -151,12 +161,23 @@ public function form(array $form, FormStateInterface $form_state) {
    +      if ($config->get('password_type_reveal')) {
    ...
    +          '#type' => 'password_reveal',
    ...
    +      else {
    ...
    +          '#type' => 'password_confirm',
    

    if they concurrent then you need to use "states" at the settings form

  3. +++ b/core/modules/user/user.module
    @@ -1290,6 +1293,44 @@ function user_form_process_password_confirm($element) {
    +      'username' => \Drupal::currentUser()->getUsername(),
    

    no reason to affect settings with personal data

lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new20.68 KB
new2.89 KB

Reroll from #156. I also tried to make few of the texts more generic since depending your site setup, they might affect multiple places.

jofitz’s picture

Issue tags: -Needs reroll

Removed "Needs Reroll" tag.

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

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now 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.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

daniel kulbe’s picture

StatusFileSize
new11.02 KB

Rerolled against 8.8.x-dev

Status: Needs review » Needs work

The last submitted patch, 172: password-reveal-2293803-172.patch, failed testing. View results

amateescu’s picture

Status: Needs work » Needs review
StatusFileSize
new20.71 KB
new1.35 KB

The reroll from #172 didn't include the new added by the previous patches.

Here's another reroll for 8.8.x and some small cleanups.

Status: Needs review » Needs work

The last submitted patch, 174: 2293803-174.patch, failed testing. View results

amateescu’s picture

Status: Needs work » Needs review
StatusFileSize
new20.71 KB
new486 bytes

Fixed the deprecated method call.

bnjmnm’s picture

Status: Needs review » Needs work

This would be a great addition to core! Here's a review to help move things along:

  1. Steps on how to evaluate this patch locally should be added to the issue summary (I see the "needs issue summary" tag is already there so there are likely needed changes beyond this)
  2. +++ b/core/misc/revealpass.es6.js
    +++ b/core/misc/revealpass.es6.js
    @@ -0,0 +1,57 @@
    

    Even within the core/misc/ directory, there's no consistent naming convention for JS files, but the most common is separating words with dashes. (theres only one other example of all-lowercase combined words: tabbingmanager.js)
    To lean in the direction of consistency and make the purpose of the file a bit clearer, something like password-reveal.js or password-unmask.js is preferable.

  3. +++ b/core/modules/user/src/AccountSettingsForm.php
    @@ -167,6 +167,11 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    +      '#title' => $this->t('Use password reveal, not password confirm'),
    

    This label alone is probably not sufficient to those not yet familiar with this new functionality. This could be improved by making the label just "Use password reveal" and adding further information in #description

  4. +++ b/core/modules/user/user.install
    @@ -103,3 +103,10 @@ function user_update_8100() {
    diff --git a/core/modules/user/user.js b/core/modules/user/user.js
    
    diff --git a/core/modules/user/user.js b/core/modules/user/user.js
    index ec9735cf08..ef8f57f7c9 100644
    
    index ec9735cf08..ef8f57f7c9 100644
    --- a/core/modules/user/user.js
    
    --- a/core/modules/user/user.js
    +++ b/core/modules/user/user.js
    

    This file shouldn't be any different from HEAD -- the newline change causing this can be addressed with a quick yarn js:build

  5. +++ b/core/lib/Drupal/Core/Render/Element/PasswordConfirm.php
    @@ -81,7 +81,10 @@ public static function processPasswordConfirm(&$element, FormStateInterface $for
    +        'data-drupal-password-strength' => TRUE,
    
    +++ b/core/lib/Drupal/Core/Render/Element/PasswordReveal.php
    @@ -0,0 +1,50 @@
    +    $element['#attributes']['data-drupal-password-strength'] = TRUE;
    

    I see these two instances of creating the data-drupal-password-strength attribute and setting it to true, but I don't see anything in the patch or core that puts this attribute to use, and it is always set to true regardless of the value of the corresponding user setting. Comment #162 mentioned

    I could see the usefulness of allowing people to turn the strength indicator on and off in certain instances. Here's an updated version of #156 but allowing the data-drupal-password-strength value to be set at the form level and passed on through to JS.

    This may not be in scope of the issue either.
    (but it is also possible I missed something in the prior 176 comments 🙂

  6. +++ b/core/lib/Drupal/Core/Render/Element/PasswordReveal.php
    @@ -0,0 +1,50 @@
    + * Password form element has hidden text that may be revealed by the user.
    

    More accurate to say the text is masked, referring to markup as "hidden" tends to mean it is not visible at all.

  7. +++ b/core/misc/revealpass.es6.js
    @@ -0,0 +1,57 @@
    +  /**
    +   * Reveal click handle that either shows or hides the password.
    +   *
    

    nit: handle/handler (should be changed in the function name as well)

  8. +++ b/core/misc/revealpass.es6.js
    @@ -0,0 +1,57 @@
    +  function revealClickHandle(event) {
    

    This and revealLink() should use ES6 arrow function syntax.

  9. +++ b/core/modules/user/tests/src/Functional/UserEditTest.php
    @@ -115,6 +115,19 @@ public function testUserEdit() {
    +    // Test editing the user with a password_reveal field.
    +    $config->set('password_type_reveal', TRUE)->save();
    +    $config->set('password_strength', TRUE)->save();
    +
    +    $this->drupalGet("user/" . $admin_user->id() . "/edit");
    +    $this->assertRaw('Password strength:', 'The password strength indicator is displayed.');
    +
    +    $edit = [];
    +    $edit['pass'] = $this->randomMachineName();
    +    $edit['current_pass'] = $admin_user->pass_raw;
    +    $this->drupalPostForm("user/" . $admin_user->id() . "/edit", $edit, t('Save'));
    +    $this->assertRaw(t("The changes have been saved."));
    

    This could use an assertion that confirms the password is not visible. This would prove that the form element errs on the side of caution in no-js sessions.

  10. +++ b/core/modules/user/user.module
    @@ -1327,6 +1330,44 @@ function user_form_process_password_confirm($element) {
    +  if (\Drupal::config('user.settings')->get('password_strength')) {
    +    $password_settings['showStrengthIndicator'] = TRUE;
    +    $password_settings += [
    +      'strengthTitle' => t('Password strength:'),
    +      'hasWeaknesses' => t('To make your password stronger:'),
    +      'tooShort' => t('Make it at least 12 characters'),
    +      'addLowerCase' => t('Add lowercase letters'),
    +      'addUpperCase' => t('Add uppercase letters'),
    +      'addNumbers' => t('Add numbers'),
    +      'addPunctuation' => t('Add punctuation'),
    +      'sameAsUsername' => t('Make it different from your username'),
    +      'weak' => t('Weak'),
    +      'fair' => t('Fair'),
    +      'good' => t('Good'),
    +      'strong' => t('Strong'),
    +      'username' => \Drupal::currentUser()->getAccountName(),
    +    ];
    +  }
    

    Since this is identical to existing logic in user.module, it may be worth moving this to a trait as problems could emerge if a change is made to one and not the other.

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

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

chop’s picture

Status: Needs work » Needs review
Issue tags: -JavaScript +JavaScript
StatusFileSize
new22.79 KB
new22.67 KB

Attempt to address issues raised in code review at #177 and re-roll against 8.9.x-dev

Status: Needs review » Needs work

The last submitted patch, 179: 2293803-179.patch, failed testing. View results

bnjmnm’s picture

Thanks for giving this issue some attention @chOP!

The test failure doesn't have anything to do with the patch itself, but a new requirement of FunctionalJavascript tests that wasn't present when the previous patch was added.

Adding this to PasswordRevealTest should take care of it

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

I'll keep an eye on the issue and review again once the next patch is in.

chop’s picture

I will also rename that test class to PasswordUnmaskTest match the renaming elsewhere.

tarekdj’s picture

Status: Needs work » Needs review
StatusFileSize
new22.8 KB
new949 bytes

Attached a patch based on #181 and #182

bnjmnm’s picture

Issue tags: +Needs reroll

Looks like a reroll is needed for the patch to apply. It should only require a change to \Drupal\Core\Render\Element\PasswordConfirm::processPasswordConfirm
It should apply fine f the the $element['pass2'] array looks like this:

$element['pass2'] = [
      '#type' => 'password',
      '#title' => t('Confirm password'),
      '#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'],
      '#required' => $element['#required'],
      '#attributes' => [
        'class' => ['password-confirm', 'js-password-confirm'],
        'autocomplete' => ['new-password'],
        'data-drupal-password-strength' => TRUE,
      ],
      '#error_no_message' => TRUE,
    ];
sokru’s picture

Issue tags: -Needs reroll
StatusFileSize
new22.57 KB

Reroll based on #183, taking into account the comment from #184.

honza pobořil’s picture

It an age when most users should use password manager, Oauth or email login should we care more about usability of password field (what will be filled by a p. m.) or about better login options in core?

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

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now 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.

george.karaivanov’s picture

StatusFileSize
new24.3 KB

Update patch #185 to be applied on drupal 8.9.1

hardik_patel_12’s picture

StatusFileSize
new22.62 KB

Last patch failed to apply , re-rolling for 9.0.x kindly review.

Status: Needs review » Needs work

The last submitted patch, 189: 2293803-189.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

kishor_kolekar’s picture

Status: Needs work » Needs review
StatusFileSize
new23.92 KB
new1.03 KB

please review patch

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

mgifford’s picture

Here is another article highlighting why this issue matters https://uxmovement.com/forms/why-the-confirm-password-field-must-die/

@bnjmnm thanks for watching this. Were your issues from 2 years ago addressed? @andypost had some comments too and @andrewmacpherson a full 3 years ago.

Is @kishor_kolekar's last patch close?

sokru’s picture

Status: Needs review » Needs work
StatusFileSize
new35.15 KB
new42.01 KB
new40.26 KB

If the button element is chosen I think it should have also button class <button class="button...">. This way it would be look ok on Olivero theme, but weird on focus with Seven theme.

Olivero theme with patch #191:
With patch

If button class would be applied on Olivero theme:
With button class on Olivero theme

If button class would be applied on Seven theme:
With button class on Seven theme

andrewmacpherson’s picture

I've already taken a quick read of the latest patch. I'd like to take time to do some testing with assistive technology

Good parts:

  • The behaviour involves changing between <input type="password"> and <input type="text">. I think that's a safe method for assistive tech, but we should definitely do some manual AT testing before committing this. This was already the case last time I checked this issue.
  • It defaults to a masked password, and doesn't try to remember the state across page loads. I didn't see any code which tried to remember the masked/visible state. Have I understood the patch correctly?

Needs work:

Question: if the password field is part of an AJAX-enabled form, and it gets re-rendered after an AJAX response, will it appear masked?

The button has a dynamic accessible name (i.e. the button text changes). This isn't very reliable....

  • It conflates the button's name (purpose) with it's current state. The name of the button is the opposite of the current state, and this can confuse blind users. Leonie Watson discusses this a webinar: How A Screen Reader User Accesses The Web (approx 54 minutes into the video).
  • Worse, some browser/AT combinations DON'T report the changed name. I don't like the risk that the current state will be misunderstood because of this problem. It could be disastrous if a user thought the password wasn't visible, but someone nearby was able to see what was typed.

It would be safer to employ an ARIA role=switch pattern (which behaves similar to a checkbox). This way we avoid using a dynamic name, and avoid conflating the purpose with the current state. The idea is that screen readers would say "Show password, switch, not checked", then "Show password, switch, checked". See these fairly recent notes on switch role support.

I wonder if "show" is too vague. This is about changing the behaviour of an existing input , but "show" is often used to mean "reveal additional controls". A clearer name would be something like "make password visible", so screen readers would say "make password visible, switch, not checked". Having said that, I've seen the "show password" name in plenty other websites, so it might be a familiar enough name; I still think "visible" would be a stronger term though.

The toggle comes after the text box, which can cause confusion in a couple of ways:

  • It's likely that some screen reader users will not yet be aware that this button is available when they encounter the password field. This could be improved by using an accessible description to mention the nearby switch. Ideally this hint will be visible to everybody, not just screen reader users. The Form API #description is suitable.
  • When using an on-screen keyboard, the keyboard typically slides up close to the text box, and obscures content which comes after it. A sighted user could also miss the fact there was an option to make the password visible, depending on how the content wraps (think about the browser's text zoom and window size). A design which puts the toggle above the text input could be more effective.

Leave the "needs accessibility review" tag in place for now. Get accessibility maintainer sign-off before committing.

andrewmacpherson’s picture

I was looking at Microsoft Edge DEV channel today (version 89, on Linux) and noticed a password setting I hadn't seen before.

Edge password settings screen

Show the "Reveal password" button in password fields
Selecting this button shows what you've typed. Some sites may override this setting

Here's a screenshot of the button it produces:

Screenshot of a password field in Edge. There's a reveal-password eye icon inside the password field.

This setting isn't available in the current stable releases of Chrome, Opera, or Brave. I don't know if this is an Edge-only feature, or whether it will be available in other Chromium-based browsers.

We should ensure our show-password button won't interfere with the one provided by the browser. I don't think we have to avoid providing one, or try to detect the browser setting though. We just need to make sure our button doesn't prevent a user operating the browser's built-in version.

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

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

rkoller’s picture

In the course of research for https://www.drupal.org/project/ideas/issues/3251513 I've discovered this issue here. I wanted to test the current state of the patch. But i was unable to apply the patch neither to 9.1.15 nor to 9.3.x-dev or 9.4.x-dev. In each case it failed to apply. :/

lendude’s picture

Status: Needs work » Needs review
StatusFileSize
new23.94 KB
new23.96 KB

Reroll and trying to clean up some CS issues, don't think I got all of them.....

lendude’s picture

StatusFileSize
new3.12 KB
new23.67 KB

Let's see what this does.

Status: Needs review » Needs work

The last submitted patch, 201: 2293803-201.patch, failed testing. View results

kostyashupenko’s picture

StatusFileSize
new24.18 KB
new5.67 KB

Kicking jquery

rkoller’s picture

thank you for the rerolls! the last two patches (#201 & 203) apply again on 9.4.x-dev with php 8.0.14 on ddev (even though #201 has failed tests). but unfortunately while the patches get applied and i see changes listed in the patch files applied to the sites assets - when actually accessing user/1/edit or perform a fresh site install i still see the old enter password/confirm password fields. the new pattern isn't used currently.

Christopher Riley’s picture

Latest patch does not work with 9.4 via composer.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

daniel kulbe’s picture

StatusFileSize
new0 bytes

Updated patch for 9.5.x

daniel kulbe’s picture

StatusFileSize
new24.21 KB

Re-upload

gauravvvv’s picture

Status: Needs work » Needs review
StatusFileSize
new24.23 KB
new1.64 KB

Fixed build errors, Attached interdiff for same. please review

smustgrave’s picture

Status: Needs review » Needs work

Seems patch #210 failed to apply.

This was previously tagged for issue summary update which from what I can tell still needs to happen please.

Thanks.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

rkoller’s picture

Issue tags: +Needs reroll

During yesterdays usability meeting #3383430: Drupal Usability Meeting 2023-09-01 we've discussed #3272325: Password suggestions are hidden from screenreaders and the whole password creation and altering process in the Drupal installer and on the user profile page in general. This issue was touched during the discussion. There was a clear consensus in the group that from a usability standpoint it would be a more than welcome and important issue to fix.

I am adding the Needs reroll tag as recommended in the meeting by @benjifisher and @lauriii . #201 "might" be a good place to start the reroll @lauriii presumes. All patches after that failed tests as well and as noted in #204 even though the patch in #203 successfully applied none of the actual functionality was available in the interface so maybe that is not a good place to start.

And for the record #3383430: Drupal Usability Meeting 2023-09-01 will have a link to the recording of the meeting. The attendees at the meeting were @aaronmchale, @benjifisher, @emma-horrell, @lauriii, @rkoller, and @worldlinemine.

rkoller’s picture

And for reference the following comment might be of use for this issue as well: #3272325-6: Password suggestions are hidden from screenreaders. I've compared the password field behavior there between Drupal, WordPress, Typo3, Joomla!, and CraftCMS including short videos for each of the systems illustrating the usage with MacOS VoiceOver. All of them have a hide and show functionality for the password but with differing behaviors implementation wise. Maybe the videos are of any use for this issue as well.

gauravvvv’s picture

Status: Needs work » Needs review
StatusFileSize
new20.62 KB

I have created a patch for 11.x, please review

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new6.05 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

rkoller’s picture

Thanks for working on the reroll @gauravvv

I've successfully applied the patch in #215 to a Drupal 11.x-dev install. The hide and show functionality is working in the latest version of Microsoft Edge on MacOS 12.6.8 while the hide and show icon and functionality is not available for Safari 16.6 and the latest Firefox. I will test it functionally with VoiceOver later today in Edge for now. And a few tests are also failing.

rkoller’s picture

StatusFileSize
new16.88 KB
new14.55 KB
new21.99 KB

A few details I've noticed when testing in the latest stable version of Microsoft Edge and VoiceOver on MacOS Monterey (12.6.8):

1. As soon as a field that is showing and unhiding a password looses focus (for example you open devtools, you click outside of the field or window) the password is hidden again. Problem is the hide/show icon completely disappears. You have to clear the password field and start to reenter something that the icon is showing up again.

2. When the password field looses focus there is no announcement in the screenreader that the state of the password changes back to hidden. That way as a screenreader user I would expect that the password is still visible in the state I have set before?

3. Is the "confirm password" field necessary at all with the ability to hide and show the password? That way one is able to check and or copy and paste the visible password? Other CMSes also have dropped the confirm password field with a hide/show password functionality in place - see #3272325-6: Password suggestions are hidden from screenreaders

4. In Edge the Icon is not accessible by the keyboard. After entering a string into the password field and the hide/show icon was showing up I was unable to reach the hide/show icon by keyboard. I've tried to tab (for the "current password" field the "reset your password" link gets into focus for the "password" the "confirm password" gets into focus on tab) and to use VO and arrow keys. In both cases I was unable to reach the hide/show icon.

5. In combination with the announcement text " you are currently on a text field. to enter a text in this field type. this is a secure text field. text typed into this field will not be displayed and will not be spoken by VoiceOver." the option to hide/show passwords is invisible and not directly apparent to the screenreader user (#195 see also https://www.drupal.org/project/drupal/issues/2293803#comment-13968132 ).

6. If I manually click the hide/show icon and set the password to visible that change isn't announced by VoiceOver instead I again get the same announcement like when the password is hidden "you are currently on a text field. to enter a text in this field type. this is a secure text field. text typed into this field will not be displayed and will not be spoken by VoiceOver."

6. Unfortunately the functionality isn't showing up in Safari. But I suspect there might be some overlap and interference between the Safari password widget and the hide/show password icon.

the drupal password field showing the Macos password widget inline at the right end of the password field

Both inline inside the password field already leads to issues for Typo3

the password field in typo3 showing the Macos password widget inline and the hide and ashow password icon overlapping at the right end of the password field

and it might be difficult to accomplish some sort of coexistence and clean layout for both.

one potential idea so solve 4 and avoid in particular 6 might be to add an hide/show button right after the password field with the icon and a label text instead of just the inline icon within the password field. that way things would be more explicit and clear - a pattern wordpress applies:

the drupal password field showing the Macos password widget inline at the right end of the password field

that might cover also the point brought up in #195 that just hide and show as label might be too vague for screenreader users.

for sighted users having an icon with a label based on the state (hidden or shown) would make things clear; having just an icon might make some users think about its meaning. and for screenreader users having an a bit more verbose aria label with something like "make password visible" and the switch state would be clearer as well (the exact wording would have to be discussed). and @andremacpherson also suggested to make the user aware if the toggle comes after the text box.

vsujeetkumar’s picture

StatusFileSize
new20.53 KB
new1.2 KB

Fixed the CCF issues, Need to addressed #218, So Keep as in 'Needs work'.

vsujeetkumar’s picture

StatusFileSize
new20.53 KB
new502 bytes

Fixed the fail test case. Please have a look.

Utkarsh_33 made their first commit to this issue’s fork.

utkarsh_33’s picture

StatusFileSize
new61.06 KB

Now the show password is properly spaced.Attaching the screenshot.

hooroomoo’s picture

Left some comments, could you also update the issue summary?

utkarsh_33’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: -frontend, -CSS, -SprintWeekend2016, -SprintWeekendBOS, -Dublin2016, -SprintWeekend2017, -Needs reroll

Trying to clean up the tags some. Don't see much use that this ticket was worked on at an event in 2016 :) feel free to add any back.

Hate to do it but was previous tagged for issue summary and don't believe that has happened.

utkarsh_33’s picture

The MR now has the password_type_reveal config set to true for the existing as well as new users so as to keep it consistent. The users can disable it if they want from the account settings.

utkarsh_33’s picture

I had a discussion with @lauriii and @tim.plunkett and we decided to deprecate the password_confirm and remove the user configurability of the new password show/hide functionality.

catch’s picture

Drupal\Core\Installer\Form\SiteConfigureForm also needs updating to switch to the new element.

rkoller’s picture

Some additional aspects not mentioned yet. I've tested the lasted state of MR4780

I think the width of the password strength indicator should have the same width as the password field like without the patch applied. Because with the patch applied the strength indicator width follows the viewport width instead of the fields's width as shown in #223. For wide screen monitor >30" it becomes an even more visually challenging task to check the actual current strength and then jump back and forth to the password field.

Would it make sense to add the hide and show functionality for the current password field as well on the user profile page? what applies to the new password field applies to the current password field as well. If i want to see the entered new password i would also like to be able to see the current password entered.

And was it an intentional step to remove the password suggestions box? The box isn't shown anymore after the first character is entered like before.

utkarsh_33’s picture

Status: Needs work » Needs review
rkoller’s picture

StatusFileSize
new17.74 KB
new70.69 KB
new32.83 KB

thanks for the changes @utkarsh_33! i've applied the latest changes and i can confirm that the password suggestions (#230.3) are back in and that the show and hide password functionality is also available for the current password (#230.2) now. neat thank you!

1. But by making the password suggestions available again the width of the suggestion box is now the same as the width of the strength indicator. that way that block gets even more visual weight for widescreen displays in particular.
strength indicator and password suggestion span across the whole page width
i still vote for the behavior that was in place before the patch, that the width of the strength indicator and the suggestion box is the same as the width of the width of the password field.
strength indicator and password with the same width as the password field before the patch was applied

2. Another detail i've noticed when testing the functionality on microsoft edge i've noticed that chrome based browsers provide such a functionality out of the box as an inline icon:

password field containing a show password icon inside the password field plus the show password link after in microsoft edge

would it be possible to hide that icon chrome based browser provide somehow? cuz having two options alongside is sort of redundant and confusing to the users. plus the icon disappears as soon as the field looses focus and isn't reappearing if the field regains focus.

3. one detail that was first raised in #195 is the question how the state of the field (if hidden or shown) is announced to a screenreader user. i've added a jump mark to the link to leonie watsons talk on youtube: https://youtu.be/OUDV1gqs9GA?t=3219 . there she illustrates well the problem if the aria-pressed attribute is used in combination with having a button label for the different states. in the current state of the patch the announcement for the toggle button in voiceover in safari is:

show password, toggle button
hide password, selected, toggle button

for hide password it would make me at least think. if the dynamic button labels should be kept the suggestion in #195 was to use the role="switch" attribute instead of the aria-pressed attribute.
the other option might be to keep the aria-pressed attribute but use a consistent label of either show password, reveal password, or View password. View password might tackle the worries @andrewmacpherson in #195 raised in regards of the clarity of the button label as well. for screenreader users that would be the clearest approach imho.
for sighted users instead is having the same button label for both stats not that clear. two suggestions in that regard. in general would it make sense to move from a plain text link styling to a button styling? Then one option might be to have the label View password and when aria-pressed is set to true have a pressed button styling that signifies the function is active. the downside i am not sure if a styling for a pressed toggle button already exists in the drupal design system?
the other option might be to make the button label visually hidden and add an icon for the visible state (an eye icon for example) and an icon for hidden state (a striked through eye icon) and dont announce those icons by the screenreader?

4. another point mentioned in #195 about "The toggle comes after the text box, which can cause confusion in a couple of way" would still need an agreement on a solution. the suggested approach there is to go with an accessible description mentioning the nearby switch.

mgifford’s picture

I definitely prefer the show/hide feature to be outside the input field. That example with the Light/Dark mode that you pointed to in the Youtube video would work well. Would allow us to have the button as a button too. Probably we'd want to swap the text or image to let folks know that their password is now visible (or invisible).

narendrar’s picture

StatusFileSize
new148.16 KB

When tested manually, found some issues. Please see attached screenshot:

  • Show/hide password is visible as button with missing css, may be
  • Password strength indicator is showing below current password field + 232.1
  • Confirm password is still showing up on site install.

narendrar’s picture

Status: Needs review » Needs work
utkarsh_33’s picture

I have assigned the show password button and Aria role=switch as mentioned in #195 along with the updated message requested.

utkarsh_33’s picture

StatusFileSize
new370.54 KB

I have added the ability to add the strength bar optionally as you can see the screenshots optional strength indicator addressing Comment#234.2.

utkarsh_33’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Seems to have a test failure

Also could someone familiar with the issue take a look at the issue summary. Was tagged a long time ago but scanning the page don't know if it was updated.

bnjmnm’s picture

StatusFileSize
new138.52 KB
  • The toggle uses a <button> tag, as it should. However, it is styled like a link - there should be a means of visually distinguishing the button (which triggers functionality) from a link (which takes the user to a new destination). This should be happening regardless, but it's particularly a concern here since the looks-like-a-link toggle is quite close to an actually-a-link element that is styled the same
  • This has been mentioned in other comments, but I notice the password input in the login form does not have this password-show functionality. It seems like a good idea to include that here - even if it were planned for later that would be the most effective way to confirm the implementation can support this use. If there's a solid reason for not including it within this issue's scope, that should be included in the issue summary (it is possible I missed an explanation in the many comments above)
  • The final item in #195 (The toggle comes after the text box...) is probably worth addressing, even if I haven't seen it addressed in other accessible password widgets. Any measures that can be taken to avoid unknowingly visually revealing a password should probably happen. At the risk of having a
    different take from the more-thorough #195, I'd prefer this information to be visually hidden as the hide/show state should already be reasonably apparent to sighted users via the buttons, and the password fields are already a bit visually noisy as-is. The #description approach might but would need to preserve any existing description. Another possibility is using aria-description and appending any text from the description element.
  • It seems like there may need to be some additional styling to remove the MS Edge provided hide/show controls. My usually-reliable Virtualbox that lets me use Windows 11 is not cooperating, so I'll either need to get that addressed or better yet someone with an already-available Windows environment could check that out.
  • The change record needs more detail. It's currently showing before after screenshots of the profile form and says "Previously the users were asked to re-enter the password in the confirm password field and if the user enters the password it cannot be viewed in both the password field. So with this MR we want to deprecate the confirm password field and add a button next to the password field which will enable the user to see the password." Lets update it to remove mentioning "MR" (once merged it's no longer an MR 😉), describe the new render elements, and provide code examples of how they are used compared to their predecessors. One of the best ways to get a sense of what goes into a good change record, is to go through the list of existing change records and see how they are written.
utkarsh_33’s picture

StatusFileSize
new34.15 KB

I have addressed the feedbacks in #240 related to link should look like a button and also included the show/hide functionality in the login form.
Attaching the screenshots to get feedbacks if any from design perspective for the latest change
password field.
Also regarding the comment related to #195 related to (The toggle comes after the text box...) i think I'm not a 100% sure about this change.So maybe some further help is required on that point.

simohell’s picture

Regarding #240 there is widespread patterns of having the "show password" styled as a link. For instance USWDS
https://designsystem.digital.gov/templates/authentication-pages/sign-in - that should be accessible.
But I do see the problem with having an actual link close by...

bnjmnm’s picture

Also regarding the comment related to #195 related to (The toggle comes after the text box...) i think I'm not a 100% sure about this change.So maybe some further help is required on that point.

If a user navigates to the password field via a screenreader, and that password field is currently set to type="text", thus making the password field visible. They are not aware of this fact until after they've entered a password and navigated forward to the hide/show button. Ideally, when the password is fully visible, an AT user should be aware of this as soon as they land on the password field.

utkarsh_33’s picture

StatusFileSize
new465.22 KB
new441.32 KB

AFAIK If the user navigates to the password field via a screenreader the password field is set to type="password" by default unless you toggle it's type to text after pressing the show password button.
Attaching the screenshots for respective states.
Initial state:
initial state

State after clicking the show password button:
reveled password state

ckrina’s picture

Issue summary: View changes
StatusFileSize
new17.96 KB

I totally understand the different points made for this element to look more like a button, and different from a link. But on a design perspective using a regular button is not good enough: apart from it being an unusual pattern, it takes too much visual attention to it and the expectations from users after clicking a button might not be what we expect.
All the accessibility feedback needs to be addressed but we can't penalize sighted users this way. Luckily, this discussion has already happened with other UI elements and we reached an agreement for an element: the Action link, used in the "Show/hide row weights".
So my recommendation here would be using the component Action link, on its small variation. It would look like this:

(Obviously the icon would switch with the text too as it's already happening with the "Show/hide row weights".)

utkarsh_33’s picture

StatusFileSize
new44.78 KB
new45.31 KB

Thanks for the clarity @ckrina. I have updated the element as requested.Attaching the Screenshots for both the states.
Show password state:
show password

Hide password:
hide password

utkarsh_33’s picture

Status: Needs work » Needs review
utkarsh_33’s picture

I have also updated the CR.

omkar.podey’s picture

Status: Needs review » Needs work

Nice work, Updated CR, most changes are related to tests which seem reasonable, just some nits with JS parts. Also needs an issue summary update since it is no longer an option to switch between the two.

utkarsh_33’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

With all this feedback still believe issue summary should be updated to latest. Or least documented why it's no longer needed

utkarsh_33’s picture

Status: Needs work » Needs review
omkar.podey’s picture

Tried to test with the MacOs Voice over functionality but it doesn't announce the aria-description could be related to https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Annotati....

It might work with other screen readers do you know of any ?

utkarsh_33’s picture

Title: Replace confirm password field with show/hide functionality » Replace confirm password element with a new password element with show/hide functionality
Issue summary: View changes
StatusFileSize
new302.19 KB
new313.92 KB
tim.plunkett’s picture

rainbreaw’s picture

The following are comments based on the a11y maintainers' discussion during the office hours today (and not a recommendation for moving this forward -- we are putting them here for reference). A maintainer will follow up with an actual recommendation shortly.

--------------

When providing a toggle switch, it is useful to focus the label on the function which is changing rather than changing the whole text. We aware that needs of screen reader users may be at odds with the needs of people with cognitive disabilities.

In order to prevent confusion for both an individual using a screen reader (changing the label of a toggle element), and an individual with a cognitive disability that can make it difficult to generalize concepts and need things to be direct and explicit.

In this case, a label of "password visibility" would focus on the function of the toggle instead of the state, which can avoid this conflicting confusion.

A screen reader user will also have an affordance through the screen reader indicating the current state, so the same would need to be present for a sighted user. Example: an icon that changes its qualities to convey the current state to the user. It should not be assumed that the actually presence of a visible password is sufficient to convey the current state to a sighted user.

prashant.c’s picture

bnjmnm’s picture

Status: Needs review » Needs work

Currently, visibility can only be toggled by pointer device, so it is not possible to test screenreader/AT implementation.
I left feedback in the MR regarding how to address this, and once that is completed I can potentially provide accessibility signoff.

kunal.sachdev made their first commit to this issue’s fork.

brooke_heaton’s picture

Hey folks, been around for a while and trying to follow the transition from patches to MRs but as I'm on Drupal 10.2 I have absolutely no idea which patch or MR I should be using for this. Can anyone advise?

kunal.sachdev’s picture

tim.plunkett changed the visibility of the branch 2293803-replace-confirm-password to hidden.

kunal.sachdev’s picture

Status: Needs work » Needs review

Addressed all the feedback. Also there is an unrelated CSpell failure in MR fatal: bad object c574a6e4f0867d27a49a244ee9648d7adfaf9f9b.

fjgarlin made their first commit to this issue’s fork.

kunal.sachdev’s picture

Status: Needs review » Needs work

Going to work on resolving the test failures.

kunal.sachdev’s picture

The performance test is failing because this is introducing an additional cache query in core/modules/user/user.module::user_form_process_password_unmask(). I think we can increase the query counts by one to resolve the test failure.

kunal.sachdev’s picture

Status: Needs work » Needs review
mgifford’s picture

I took a look with this issue with VoiceOver, and with keyboard-only reviews. This looks good. Like the new pattern with the show/hide text.

rkoller’s picture

StatusFileSize
new61.89 KB

I've noticed one detail when I tried to log into the site with the latest changes from this MR applied. The login screen is also showing me the password strength indicator as soon as i start to enter a password there.

login screen of a drupal site with the username and password entered. the password is hiden but underneath the password strength indicator is shown

plus the Show password would probably need some styling.

mgifford’s picture

There's been some discussion in Slack to move the password strength indicator before the input form so that a user is told how they should comply before fill in the form. I thought that the password strength indicator was semantically linked to the password field by aria-describedby but can't seem to find that now.

I suspect with these changes we should put on "Needs Accessibility Review" and "Needs Usability Review" but I wonder if we can't commit this and create two smaller follow-up issues.

This one is already approaching its 10th anniversary.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new90 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

sakthi_dev made their first commit to this issue’s fork.

sakthi_dev’s picture

Rebased with latest changes by resolving conflicts.

rkoller’s picture

There is one detail to note about the micro copy used for the aria-label that is based on the suggestion made in #195) . When tested in VoiceOver you get the following announcements:

make password visible, on switch
make password visible, off, switch

The problem is the following, the cognitive load is rather high for figuring out what the actual current state is and what the future state will be when clicking the button. make password visible, on switch describes an action to take, to make the password visible, with the switch set to on - but the state the password field is in is hidden. While with make password visible, off switch the password is actually shown. Based on the aria-label I would expect that state of the password field the exact opposite way around than it actually is.

I've discussed the topic with @mgifford in this thread on Slack as well as @Emma Horrell today. There was a consensus in both discussions that the current label is hard to comprehend in context, even though the reasoning behind was valid in the first place.

In both discussions we've tried to ideate and come up with alternatives. Instead of using a task like "make ..." use a term that describes the state or function of the button was the goal. Something like Password camouflage would describe things well but it is a way too abstract term. Other ideas were Password cloak (the term cloak is usually used in a slight different context not to hide but to encrypt), Password mask (the term mask is probably too ambiguous, unclear and context sensitive), and Password hidden. In the end we tried to simply invert the term visible and remove the verb make which brought us to:

Password invisible, on, switch => password hidden
Password invisible, off, switch => password shown

Still not perfect but it would be at least more clear. We also tried to explore what other sites and CMSes use, but most or better all of them in case they have the hide and show functionality use the same switching labels sighted users see (checked a few: WordPress, Joomla, GitHub, GitLab, Twitch, Amazon, the MoJ Design System from gov.uk). Further options could be to do some wordsmithing for the aria-label at the next usability meeting and/or to run a one-two punch content test with users.

omkar.podey’s picture

Status: Needs work » Needs review

I guess the show password isn't that important on the login page so just removed it with the strength indicator.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new13.48 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

omkar.podey’s picture

StatusFileSize
new112.77 KB
new99.81 KB

Updated for login show password.

On hover

omkar.podey’s picture

Status: Needs work » Needs review
kunal.sachdev’s picture

Status: Needs review » Reviewed & tested by the community

The changes looks good.

longwave’s picture

Status: Reviewed & tested by the community » Needs work

Added some questions to the MR.

longwave’s picture

Also this feels like a fairly late and possibly disruptive change, should we consider keeping the old element around until Drupal 12 as per #3410492: Defer disruptive 10.3 deprecations for removal until 12.0? There seems no harm in doing so.

rkoller’s picture

sorry for the late reply @omkra.podey but i had to wait before i got word from the others who ideated on the aria-label suggestions with me. i've now manually tested the patch again another time:

It is a good choice that you've readded the hide and show password button in #277. It is definitely useful for the login page in the front end. the only nitpick i've noticed in claro there is the eye icon, that icon is missing in olivero in the front end. but this minor styling issue might moved to a followup issue?

in regards of the aria-label Password invisible it is definitely an improvement over make password visible making the label more clear. I still had some doubt after actually testing it with voiceover because Password invisible from a grammatical perspective sounded slightly off and something like Password invisibility, on would feel more grammatically correct as @Emma Horrell put it. But the term invisibility has the downside that it is too complex and invisible conveys the meaning adequately. So the arial-label seems good to go. And there is always the option to simply change the string of the aria-label at a later point based on user feedback and running some user test like for example a one two punch user test. But that could be done in a follow up issue if necessary and shouldn't hold back this issue.

this MR looks good overall

omkar.podey’s picture

Status: Needs work » Needs review
kunal.sachdev’s picture

Status: Needs review » Needs work

There is one remaining unanswered thread in the MR https://git.drupalcode.org/project/drupal/-/merge_requests/4780#note_280791.

omkar.podey’s picture

Status: Needs work » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new90 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

omkar.podey’s picture

Status: Needs work » Needs review
Issue tags: +no-needs-review-bot
smustgrave’s picture

I believe all threads have been answered, though can't close any. But MR needs manual rebase

Mithun S made their first commit to this issue’s fork.

mithun s’s picture

Pushed a rebase from the 11.x branch. Please review

smustgrave’s picture

Status: Needs review » Needs work

Seems rebased added some failures.

pooja_sharma made their first commit to this issue’s fork.

pooja_sharma changed the visibility of the branch 2293803-Replace-confirm-pass to hidden.

pooja_sharma changed the visibility of the branch 2293803-Replace-confirm-pass to active.

pooja_sharma’s picture

After rebased MR, fixed test failures of pipeline(II stage)

However, there are still some test failures of pipeline(III stage) that's needs to be addressed.

pameeela’s picture

Title: Replace confirm password element with a new password element with show/hide functionality » Replace confirm password element with a new element that allows toggling to view the typed password
Issue summary: View changes

daniel kulbe changed the visibility of the branch 11.x to hidden.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

andypost’s picture

not clear what's left here