Skip to content

Magento 2.2.2 password reset strength meter #13429

Closed
@zukovasmartynas

Description

@zukovasmartynas

Preconditions

  1. Magento 2.2.2 Magento Open Source
  2. Nginx
  3. Developer mode, html/css/js minify/merge/bunlding disabled.

Steps to reproduce

  1. Install Magento 2.2.2 CE
  2. Remove footer newsletter block for the customer_account_createpassword handle
    <referenceContainer name="form.subscribe" remove="true"/>
  3. Create any customer account.
  4. Logout on frontend and go to login page and click "Forgot Your Password?"
  5. Fill created customer email and click "Reset password"
  6. Follow on the link "Set a New Password" in received email letter
  7. Try enter somekind of password to the New Pasword field

Expected result

  1. Strength meter starts working, showing a different password strength as I type

Actual result

  1. Strength meter doesn't work.
    Error on the console.
    Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
    Went to the vendor/magento/module-customer/view/frontend/web/js/password-strength-indicator.js:77
    if (password.toLowerCase() === this.options.cache.email.val().toLowerCase()) {

Apearently this.options.cache.email is undefined. Checked code above where it is declared - line:34
this.options.cache.email = $(this.options.formSelector).find(this.options.emailSelector);
Checked values above:
this.options.formSelector = 'form'
this.options.emailSelector = 'input[type="email"]'

So in conlusion: email is being searched in any form, Meaning if there are no form with email - strength meter fails. I believe this can be a leftover from older code versions, because othervise this would be a bit of a nonsense.

I haven't created a branch for a fix, but I think this one would be an easy one:

  • Make form selecter to select a right form (the one that is used to reset password)
  • Add a hidden field in the form with type email with value of a customer that is reseting this password.
    Or just make do something else - its just a suggestion, if that compare is really needed.

I hope this will help someone and it will be fixed :)

Metadata

Metadata

Assignees

Labels

Fixed in 2.1.xThe issue has been fixed in 2.1 release lineFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions