Double button added in the edit password form

Created on 1 February 2023, over 1 year ago
Updated 28 February 2023, over 1 year ago

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

🐛 Bug report
Status

Fixed

Version

6.0

Component

Code

Created by

🇧🇪Belgium pmichelazzo Brussels

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @pmichelazzo
  • 🇦🇷Argentina anacolautti

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

  • 🇧🇪Belgium pmichelazzo Brussels

    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.

  • Status changed to Needs review over 1 year ago
  • 🇦🇷Argentina anacolautti

    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.

  • 🇬🇷Greece pappis Greece

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

  • 🇧🇪Belgium pmichelazzo Brussels

    @anacolautti

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

    Regards
    Paulino

  • 🇮🇳India Jaspreet-Kaur

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

  • First commit to issue fork.
  • @urvashi_vora opened merge request.
  • 🇮🇳India urvashi_vora Madhya Pradesh, India

    I created an MR for #4. Please review.

    Thanks

  • Status changed to Fixed over 1 year ago
  • 🇦🇷Argentina anacolautti

    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!

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

Production build 0.69.0 2024