Problem/Motivation

Hello there,

Trying to use the View Password module in a custom change password page, the module creates two buttons with the eye icon for each field. The problem didn't happen in the login page but happens in the admin interface using a different theme.

I'm using another contrib module (https://www.drupal.org/project/change_pwd_page) to add the password form in different pages/places and probably has some incompatibility with it.

Is there any way to avoid such problem?

Thanks

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

pmichelazzo created an issue. See original summary.

anacolautti’s picture

This is probably related to Multiple eye icon.
What browser are you using? and Drupal version? Let me know so I can try to reproduce it.
Thanks!

pmichelazzo’s picture

Hi @anacolautti, thanks to the fast reply.

The problem happens with Firefox and Chrome (at least) and I'm using the latest Drupal 9.x.

I made a change in the password.js file to avoid such problem on my project and it's working. Going a little deep into the context calls, the same file is called two or three times here.

Here is the code.

if (!$(':button').hasClass('shwpd')) {
        $('.pwd-see :password', context).after(
          `<button type="button" class="shwpd ${span_classes_custom} eye-close" aria-label="${drupalSettings.view_password.showPasswordLabel}"></button>`
        );
}

Again, thanks a lot.

anacolautti’s picture

Status: Active » Needs review
StatusFileSize
new596 bytes

Hi again!
I was able to reproduce this in D9.5.3. I was not able to reproduce in D10 since the module in use is not yet D10 ready.

Thank you @pmichelazzo for your code. I ended up using the once() function, based on the last fix on the related issue above (Multiple eye icon...). Adding the patch to this comment.

Please someone test this so that I can merge to the development branch and include in the next release.

anacolautti’s picture

Related issues: +#3324094: Multiple eye icon
pappis’s picture

Had the same problem with Drupal 9.5.3 and 6.0.2
Applied patch #4 and problem solved.

pmichelazzo’s picture

@anacolautti

I apply the patch and it's work. Thanks for it.

Regards
Paulino

Jaspreet-Kaur’s picture

Faced the same problem, after applied #5 patch my problem is resolved,
Thank you so much!!

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

urvashi_vora’s picture

I created an MR for #4. Please review.

Thanks

anacolautti’s picture

Version: 6.0.2 » 6.0.x-dev
Status: Needs review » Fixed

Thank you very much @urvashi_vora, I really had very little time these past days to close this issue. I just merged the MR.
I'll create a release with this issue fix before the end of next week.

Thank you all!

anacolautti’s picture

Version: 6.0.x-dev » 6.0.3

Status: Fixed » Closed (fixed)

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