Fix bug Magento 2.2.2 password reset strength meter #13429 #13761
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix bug "Magento 2.2.2 password reset strength meter" #13429 by doing the email comparison only if an email field exists.
The form email input field selector at the "password-strength-indicator.js" is generic enough to match any input field "email" in the frontend at that time. This causes the password strength indicator to work in the password reset email screen in the default theme, given that this selector ends up matching the email field of the newsletter subscription form.
However, if you are using a theme in which the newsletter subscription email form is removed, it then causes this password strength validation to break. Moreover, it doesn't make much sense to compare your password with any possible email that is written in the newsletter subscription form.
This was done as part of the #MLAU18 contribution day.
Description
This PR simply causes the condition in which the password is compared to the email to be skipped in this situation, removing the Javascript error. Further review of this selector (that populates the this.options.cache.email variable) to narrow it so it only matches the email fields that are part of the same form as the password field should be done in the future.
Fixed Issues
Manual testing scenarios
Contribution checklist