Skip to content

Commit 99b32cf

Browse files
aoldoniserhii-balko
authored andcommitted
Fix bug Magento 2.2.2 password reset strength meter #13429 by doing the email comparison only if an email field exists
1 parent a083717 commit 99b32cf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/code/Magento/Customer/view/frontend/web/js/password-strength-indicator.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ define([
3131
this.options.cache.label = $(this.options.passwordStrengthMeterLabelSelector, this.element);
3232

3333
// We need to look outside the module for backward compatibility, since someone can already use the module.
34+
// @todo Narrow this selector in 2.3 so it doesn't accidentally finds the the email field from the newsletter
35+
// email field or any other "email" field.
3436
this.options.cache.email = $(this.options.formSelector).find(this.options.emailSelector);
3537
this._bind();
3638
},
@@ -74,7 +76,9 @@ define([
7476
'password-not-equal-to-user-name': this.options.cache.email.val()
7577
});
7678

77-
if (password.toLowerCase() === this.options.cache.email.val().toLowerCase()) {
79+
// We should only perform this check in case there is an email field on screen
80+
if (this.options.cache.email.length &&
81+
password.toLowerCase() === this.options.cache.email.val().toLowerCase()) {
7882
displayScore = 1;
7983
} else {
8084
isValid = $.validator.validateSingleElement(this.options.cache.input);

0 commit comments

Comments
 (0)