Skip to content

Commit bbbbf9d

Browse files
mazhalaiIvan Gavryshko
authored andcommitted
Merge remote-tracking branch 'ogresce/MAGETWO-33443-password-strength' into develop
Conflicts: setup/pub/magento/setup/css/setup.css
2 parents 3ec9263 + d5abd07 commit bbbbf9d

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

setup/pub/magento/setup/create-admin-account.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ angular.module('create-admin-account', ['ngStorage'])
1818
return;
1919
}
2020
var p = $scope.admin.password;
21-
if (p.length > 6 && p.match(/[\d]+/) && p.match(/[a-z]+/) && p.match(/[A-Z]+/) && p.match(/[!@#$%^*()_\/\\\-\+=]+/)) {
21+
if (p.length >= 6 && p.match(/[\d]+/) && p.match(/[a-z]+/) && p.match(/[A-Z]+/) && p.match(/[!@#$%^*()_\/\\\-\+=]+/)) {
2222
$scope.admin.passwordStatus.class = 'strong';
2323
$scope.admin.passwordStatus.label = 'Strong';
24-
} else if (p.length > 6 && p.match(/[\d]+/) && p.match(/[a-z]+/) && p.match(/[A-Z]+/)) {
24+
} else if (p.length >= 6 && p.match(/[\d]+/) && p.match(/[a-z]+/) && p.match(/[A-Z]+/)) {
2525
$scope.admin.passwordStatus.class = 'good';
2626
$scope.admin.passwordStatus.label = 'Good';
27-
} else if (p.length > 6 && p.match(/[\d]+/) && p.match(/[a-zA-Z]+/)) {
27+
} else if (p.length >= 6 && p.match(/[\d]+/) && p.match(/[a-zA-Z]+/)) {
28+
$scope.admin.passwordStatus.class = 'fair';
29+
$scope.admin.passwordStatus.label = 'Fair';
30+
} else if (p.length >= 6) {
2831
$scope.admin.passwordStatus.class = 'weak';
2932
$scope.admin.passwordStatus.label = 'Weak';
30-
} else if (p.length > 6) {
31-
$scope.admin.passwordStatus.class = 'to-short';
32-
$scope.admin.passwordStatus.label = 'Too Short';
3333
} else {
34-
$scope.admin.passwordStatus.class = 'none';
35-
$scope.admin.passwordStatus.label = 'None';
34+
$scope.admin.passwordStatus.class = 'too-short';
35+
$scope.admin.passwordStatus.label = 'Too Short';
3636
}
3737
};
3838

@@ -71,7 +71,7 @@ angular.module('create-admin-account', ['ngStorage'])
7171
require: "ngModel",
7272
link: function(scope, elm, attrs, ctrl){
7373
var validator = function(value){
74-
var minReg = /^(?=.*\d)(?=.*[a-zA-Z])[a-zA-Z0-9]{6,}$/,
74+
var minReg = /^(?=.*\d)(?=.*[a-zA-Z]).{6,}$/,
7575
isValid = typeof value === 'string' && minReg.test(value);
7676

7777
ctrl.$setValidity('checkPassword', isValid);

setup/view/magento/setup/create-admin-account.phtml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ $passwordWizard = sprintf(
1515
<div class=\'password-strength-item\'></div>
1616
<div class=\'password-strength-item\'></div>
1717
<div class=\'password-strength-item\'></div>
18+
<div class=\'password-strength-item\'></div>
1819
</div>
1920
<p>%s</p>',
2021
'Password Strength:',
21-
'Must be a mix of at least 7 alpha and numeric characters.(Ex.: BuyIt54).'
22+
'Enter a mix of 6 or more numbers and letters. For a stronger password, include at least one small letter, big letter, and symbol (Ex: BuyIt$54).'
2223
);
2324
?>
2425

@@ -144,7 +145,7 @@ $passwordWizard = sprintf(
144145
>
145146
<div class="error-container">
146147
<span ng-show="account.adminPassword.$error.checkPassword">
147-
Please enter at least 7 alpha-numeric characters.
148+
Please enter a mix of at least 6 alpha-numeric characters.
148149
</span>
149150
<span ng-show="account.adminPassword.$error.required">
150151
Please enter your new password.

setup/view/styles/components/tooltips/_password-strength.less

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
display: block;
88
margin: 0 -.3rem 1em;
99
white-space: nowrap;
10-
&.password-strength-to-short {
10+
&.password-strength-too-short {
1111
.password-strength-item {
1212
&:first-child {
1313
background-color: @color-failed;
@@ -17,13 +17,22 @@
1717
&.password-strength-weak {
1818
.password-strength-item:first-child,
1919
.password-strength-item:first-child + .password-strength-item {
20+
background-color: @color-failed;
21+
}
22+
}
23+
&.password-strength-fair {
24+
.password-strength-item:first-child,
25+
.password-strength-item:first-child + .password-strength-item,
26+
.password-strength-item:first-child + .password-strength-item + .password-strength-item {
2027
background-color: @color-warning;
2128
}
2229
}
2330
&.password-strength-good {
2431
.password-strength-item:first-child,
2532
.password-strength-item:first-child + .password-strength-item,
26-
.password-strength-item:first-child + .password-strength-item + .password-strength-item {
33+
.password-strength-item:first-child + .password-strength-item + .password-strength-item,
34+
.password-strength-item:first-child + .password-strength-item + .password-strength-item
35+
+ .password-strength-item {
2736
background-color: @color-success;
2837
}
2938
}
@@ -38,6 +47,6 @@
3847
font-size: 0;
3948
height: 1.4rem;
4049
margin-right: .3rem;
41-
width: ~'calc(25% - .6rem)';
50+
width: ~'calc(20% - .6rem)';
4251
}
4352
}

0 commit comments

Comments
 (0)