Skip to content

Commit 727b2c3

Browse files
author
Natalia Momotenko
committed
Merge remote-tracking branch 'origin/MAGETWO-54163-new' into bugfixes
2 parents 1c4e010 + ac69cb9 commit 727b2c3

File tree

3 files changed

+40
-45
lines changed

3 files changed

+40
-45
lines changed

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

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ define([
1717
$.widget('mage.passwordStrengthIndicator', {
1818
options: {
1919
cache: {},
20-
defaultClassName: 'password-strength-meter-',
2120
passwordSelector: '[type=password]',
2221
passwordStrengthMeterSelector: '[data-role=password-strength-meter]',
2322
passwordStrengthMeterLabelSelector: '[data-role=password-strength-meter-label]'
@@ -54,14 +53,15 @@ define([
5453
var password = this._getPassword(),
5554
isEmpty = password.length === 0,
5655
zxcvbnScore = zxcvbn(password).score,
57-
isValid = $.validator.validateSingleElement(this.options.cache.input),
58-
displayScore = zxcvbnScore || 1;
56+
displayScore,
57+
isValid;
5958

6059
// Display score is based on combination of whether password is empty, valid, and zxcvbn strength
6160
if (isEmpty) {
6261
displayScore = 0;
63-
} else if (!isValid) {
64-
displayScore = 1;
62+
} else {
63+
isValid = $.validator.validateSingleElement(this.options.cache.input);
64+
displayScore = isValid ? zxcvbnScore : 1;
6565
}
6666

6767
// Update label
@@ -75,27 +75,32 @@ define([
7575
*/
7676
_displayStrength: function (displayScore) {
7777
var strengthLabel = '',
78-
className = this._getClassName(displayScore);
78+
className = 'password-';
7979

8080
switch (displayScore) {
8181
case 0:
8282
strengthLabel = $t('No Password');
83+
className += 'none';
8384
break;
8485

8586
case 1:
8687
strengthLabel = $t('Weak');
88+
className += 'weak';
8789
break;
8890

8991
case 2:
9092
strengthLabel = $t('Medium');
93+
className += 'medium';
9194
break;
9295

9396
case 3:
9497
strengthLabel = $t('Strong');
98+
className += 'strong';
9599
break;
96100

97101
case 4:
98102
strengthLabel = $t('Very Strong');
103+
className += 'very-strong';
99104
break;
100105
}
101106

@@ -112,16 +117,6 @@ define([
112117
*/
113118
_getPassword: function () {
114119
return this.options.cache.input.val();
115-
},
116-
117-
/**
118-
* Get class name for score
119-
* @param {int} displayScore
120-
* @returns {String}
121-
* @private
122-
*/
123-
_getClassName: function (displayScore) {
124-
return this.options.defaultClassName + displayScore;
125120
}
126121
});
127122

app/design/frontend/Magento/blank/Magento_Customer/web/css/source/_module.less

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,43 +41,43 @@
4141
.lib-font-size(18);
4242
}
4343
}
44-
44+
4545
.fieldset {
4646
.lib-form-hasrequired(bottom);
4747
&:after {
4848
margin-top: 35px;
4949
}
5050
}
5151
}
52-
52+
5353
.block-addresses-list {
5454
.items.addresses {
5555
> .item {
5656
margin-bottom: @indent__base;
57-
57+
5858
&:last-child {
5959
margin-bottom: 0;
6060
}
6161
}
6262
}
6363
}
64-
64+
6565
.form-address-edit {
6666
#region_id {
6767
display: none;
6868
}
69-
69+
7070
.actions-toolbar .action.primary {
7171
&:extend(.abs-button-l all);
7272
}
7373
}
74-
74+
7575
.form-edit-account {
7676
.fieldset.password {
7777
display: none;
7878
}
7979
}
80-
80+
8181
.box-billing-address,
8282
.box-shipping-address,
8383
.box-information,
@@ -96,43 +96,43 @@
9696
h2 {
9797
margin-top: 0;
9898
}
99-
99+
100100
.toolbar {
101101
text-align: center;
102102
.limiter-options {
103103
width: auto;
104104
}
105105
}
106-
106+
107107
.limiter {
108108
>.label {
109109
&:extend(.abs-visually-hidden all);
110110
}
111111
}
112-
112+
113113
.block:not(.widget) {
114114
&:extend(.abs-account-blocks all);
115115
}
116116
}
117-
117+
118118
.sidebar-additional {
119119
margin-top: 40px;
120120
}
121-
121+
122122
.table-wrapper {
123123
&:last-child {
124124
margin-bottom: 0;
125125
}
126-
126+
127127
.action {
128128
margin-right: 15px;
129-
129+
130130
&:last-child {
131131
margin-right: 0;
132132
}
133133
}
134134
}
135-
135+
136136
.table-return-items {
137137
.qty {
138138
.input-text {
@@ -141,7 +141,7 @@
141141
}
142142
}
143143
}
144-
144+
145145
// Checkout address (create shipping address)
146146
.field.street {
147147
.field.additional {
@@ -214,10 +214,10 @@
214214
margin-bottom: 0;
215215
}
216216
}
217-
217+
218218
.title {
219219
margin-bottom: @indent__s;
220-
220+
221221
strong {
222222
.lib-heading(h4);
223223
.column.main & {
@@ -272,42 +272,42 @@
272272
z-index: -1;
273273
}
274274

275-
.password-strength-meter-0 & {
275+
.password-none & {
276276
&:before {
277277
background-color: @_password-default;
278278
width: 100%;
279279
}
280280
}
281281

282-
.password-strength-meter-1 & {
282+
.password-weak & {
283283
&:before {
284284
background-color: @_password-weak;
285285
width: 25%;
286286
}
287287
}
288288

289-
.password-strength-meter-2 & {
289+
.password-medium & {
290290
&:before {
291291
background-color: @_password-medium;
292292
width: 50%;
293293
}
294294
}
295295

296-
.password-strength-meter-3 & {
296+
.password-strong & {
297297
&:before {
298298
background-color: @_password-strong;
299299
width: 75%;
300300
}
301301
}
302302

303-
.password-strength-meter-4 & {
303+
.password-very-strong & {
304304
&:before {
305305
background-color: @_password-very-strong;
306306
width: 100%;
307307
}
308308
}
309309
}
310-
310+
311311
.control.captcha-image {
312312
.lib-css(margin-top, @indent__s);
313313

app/design/frontend/Magento/luma/Magento_Customer/web/css/source/_module.less

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,35 +254,35 @@
254254
z-index: -1;
255255
}
256256

257-
.password-strength-meter-0 & {
257+
.password-none & {
258258
&:before {
259259
background-color: @_password-default;
260260
width: 100%;
261261
}
262262
}
263263

264-
.password-strength-meter-1 & {
264+
.password-weak & {
265265
&:before {
266266
background-color: @_password-weak;
267267
width: 25%;
268268
}
269269
}
270270

271-
.password-strength-meter-2 & {
271+
.password-medium & {
272272
&:before {
273273
background-color: @_password-medium;
274274
width: 50%;
275275
}
276276
}
277277

278-
.password-strength-meter-3 & {
278+
.password-strong & {
279279
&:before {
280280
background-color: @_password-strong;
281281
width: 75%;
282282
}
283283
}
284284

285-
.password-strength-meter-4 & {
285+
.password-very-strong & {
286286
&:before {
287287
background-color: @_password-very-strong;
288288
width: 100%;

0 commit comments

Comments
 (0)