Skip to content

Increase minimum password length for admin user #39319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: 2.4-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4380e20
increase minimum password length
torhoehn Nov 2, 2024
2377017
Merge branch '2.4-develop' into feature/min-password-length
engcom-Hotel Nov 25, 2024
2c1f24e
adjust further configs and tests
torhoehn Nov 25, 2024
b2a209e
Merge branch '2.4-develop' into feature/min-password-length
engcom-Hotel Jan 16, 2025
622ecda
Merge branch '2.4-develop' into feature/min-password-length
engcom-Hotel Jan 20, 2025
9f7a070
Merge branch '2.4-develop' into feature/min-password-length
engcom-Hotel Jan 27, 2025
5d13a80
Merge branch '2.4-develop' into feature/min-password-length
engcom-Hotel Jan 29, 2025
2e1d562
Fix functional test failures
glo24157 Jan 29, 2025
934054d
Fix functional tests failures
engcom-Hotel Jan 30, 2025
c52a55c
AC-13826: Increase minimum password length for admin user
engcom-Hotel Jan 30, 2025
68f19af
Merge branch '2.4-develop' into feature/min-password-length
engcom-Bravo Feb 3, 2025
3f7ae42
Merge branch '2.4-develop' into feature/min-password-length
engcom-Charlie Feb 4, 2025
7f9703e
Merge branch '2.4-develop' into feature/min-password-length
engcom-Hotel Feb 7, 2025
fc46449
Merge branch '2.4-develop' into feature/min-password-length
engcom-Hotel Feb 10, 2025
59efde6
Merge branch '2.4-develop' into feature/min-password-length
engcom-Hotel Feb 17, 2025
c9ad4a1
Merge branch '2.4-develop' into feature/min-password-length
engcom-Charlie Feb 18, 2025
efccbf9
Merge branch '2.4-develop' into feature/min-password-length
engcom-Charlie Feb 21, 2025
275896f
Fixed unit test failure
engcom-Charlie Feb 21, 2025
f260fae
Merge branch '2.4-develop' into feature/min-password-length
engcom-Charlie Feb 26, 2025
c0bba14
Merge branch '2.4-develop' into feature/min-password-length
engcom-Hotel Mar 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<see userInput="The password entered for the current user is invalid. Verify the password and try again." stepKey="seeErrorMessage1"/>
<fillField selector="{{AdminSystemAccountSection.newPassword}}" userInput="Admin@12345678" stepKey="enterPassword1"/>
<fillField selector="{{AdminSystemAccountSection.passwordConfirmation}}" userInput="Admin@12345678" stepKey="confirmPassword1"/>
<fillField selector="{{AdminSystemAccountSection.currentPassword}}" userInput="123123aaa" stepKey="fillCorrectPassword"/>
<fillField selector="{{AdminSystemAccountSection.currentPassword}}" userInput="123123aaabbb" stepKey="fillCorrectPassword"/>
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveUser2"/>
<see selector="{{AdminMessagesSection.success}}" userInput="The password of this account has been modified successfully." stepKey="seeSuccessMessage"/>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2022 Adobe
* All Rights Reserved.
*/
-->

Expand All @@ -12,8 +12,8 @@
<annotations>
<description>Reset password using old password on All Users page.</description>
</annotations>
<fillField selector="{{AdminEditUserSection.passwordTextField}}" userInput="123123aaa" stepKey="enterPassword"/>
<fillField selector="{{AdminEditUserSection.pwConfirmationTextField}}" userInput="123123aaa" stepKey="confirmPassword"/>
<fillField selector="{{AdminEditUserSection.passwordTextField}}" userInput="123123aaabbb" stepKey="enterPassword"/>
<fillField selector="{{AdminEditUserSection.pwConfirmationTextField}}" userInput="123123aaabbb" stepKey="confirmPassword"/>
<click selector="{{AdminEditUserSection.saveButton}}" stepKey="clickSaveUser"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<see userInput="This is a required field." stepKey="seeRequiredField"/>
Expand All @@ -22,8 +22,8 @@
<waitForPageLoad stepKey="waitForPageLoad1"/>
<scrollToTopOfPage stepKey="scrollToTopOfPage"/>
<see userInput="The password entered for the current user is invalid. Verify the password and try again." stepKey="seeErrorMessage"/>
<fillField selector="{{AdminEditUserSection.passwordTextField}}" userInput="123123aaa" stepKey="enterPassword1"/>
<fillField selector="{{AdminEditUserSection.pwConfirmationTextField}}" userInput="123123aaa" stepKey="confirmPassword1"/>
<fillField selector="{{AdminEditUserSection.passwordTextField}}" userInput="123123aaabbb" stepKey="enterPassword1"/>
<fillField selector="{{AdminEditUserSection.pwConfirmationTextField}}" userInput="123123aaabbb" stepKey="confirmPassword1"/>
<fillField selector="{{AdminEditUserSection.currentPasswordField}}" userInput="{{_CREDS.magento/MAGENTO_ADMIN_PASSWORD}}" stepKey="enterCurrentPassword"/>
<click selector="{{AdminEditUserSection.saveButton}}" stepKey="clickSaveUser2"/>
<waitForPageLoad stepKey="waitForPageLoad2"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2022 Adobe
* All Rights Reserved.
*/
-->

Expand Down Expand Up @@ -40,7 +40,7 @@
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1">
<argument name="username" value="$$createUser.username$$"/>
<argument name="password" value="123123aaa"/>
<argument name="password" value="123123aaabbb"/>
</actionGroup>
<actionGroup ref="AssertAdminSuccessLoginActionGroup" stepKey="seeSuccessLoginMessage"/>
<actionGroup ref="AdminResetPasswordActionGroup" stepKey="resetPassword1"/>
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/User/Model/UserValidationRules.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2015 Adobe
* All Rights Reserved.
*/

namespace Magento\User\Model;
Expand All @@ -24,7 +24,7 @@ class UserValidationRules
/**
* Minimum length of admin password
*/
public const MIN_PASSWORD_LENGTH = 7;
public const MIN_PASSWORD_LENGTH = 12;

/**
* Adds validation rule for user first name, last name, username and email
Expand Down
50 changes: 25 additions & 25 deletions app/code/Magento/User/Test/Mftf/Data/UserData.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2017 Adobe
* All Rights Reserved.
*/
-->

Expand All @@ -21,8 +21,8 @@
<data key="firstname">John</data>
<data key="lastname">Doe</data>
<data key="email" unique="prefix">admin@example.com</data>
<data key="password">123123q</data>
<data key="password_confirmation">123123q</data>
<data key="password">1234512345q!</data>
<data key="password_confirmation">1234512345q!</data>
<data key="interface_local">en_US</data>
<data key="interface_local_label">English (United States)</data>
<data key="is_active">true</data>
Expand All @@ -34,8 +34,8 @@
</array>
</entity>
<entity name="AdminUserWithUpdatedUserRoleToSales" extends="NewAdminUser">
<data key="password">123123qA</data>
<data key="password_confirmation">123123qA</data>
<data key="password">123123qA1234</data>
<data key="password_confirmation">123123qA1234</data>
<data key="role">{{roleSales.rolename}}</data>
</entity>

Expand All @@ -44,8 +44,8 @@
<data key="firstname">John</data>
<data key="lastname">Doe</data>
<data key="email" unique="prefix">admin@example.com</data>
<data key="password">123123QA</data>
<data key="password_confirmation">123123QA</data>
<data key="password">1234512345q!</data>
<data key="password_confirmation">1234512345q!</data>
<data key="interface_local">en_US</data>
<data key="interface_local_label">English (United States)</data>
<data key="is_active">true</data>
Expand All @@ -61,8 +61,8 @@
<data key="firstname">John</data>
<data key="lastname">Doe</data>
<data key="email" unique="prefix">admin@example.com</data>
<data key="password">123123q</data>
<data key="password_confirmation">123123q</data>
<data key="password">1234512345q!</data>
<data key="password_confirmation">1234512345q!</data>
<data key="interface_local">en_US</data>
<data key="interface_local_label">English (United States)</data>
<data key="is_active">true</data>
Expand All @@ -78,8 +78,8 @@
<data key="firstname">John</data>
<data key="lastname">Doe</data>
<data key="email" unique="prefix">admin@example.com</data>
<data key="password">123123QA</data>
<data key="password_confirmation">123123QA</data>
<data key="password">1234512345q!</data>
<data key="password_confirmation">1234512345q!</data>
<data key="interface_local">en_US</data>
<data key="interface_local_label">English (United States)</data>
<data key="is_active">true</data>
Expand All @@ -98,15 +98,15 @@
<data key="username" unique="suffix">admin</data>
<data key="firstName">John</data>
<data key="lastName">Smith</data>
<data key="password">admin123</data>
<data key="password">admin@123456</data>
</entity>
<entity name="Admin3" type="user">
<data key="username" unique="suffix">admin3</data>
<data key="firstname">admin3</data>
<data key="lastname">admin3</data>
<data key="email" unique="prefix">admin3WebUser@example.com</data>
<data key="password">123123q</data>
<data key="password_confirmation">123123q</data>
<data key="password">1234512345q!</data>
<data key="password_confirmation">1234512345q!</data>
<data key="interface_local">en_US</data>
<data key="is_active">true</data>
<data key="current_password">123123q</data>
Expand All @@ -129,8 +129,8 @@
<data key="firstname">John</data>
<data key="lastname">Doe</data>
<data key="email" unique="prefix">admin@example.com</data>
<data key="password">123123q</data>
<data key="password_confirmation">123123q</data>
<data key="password">1234512345q!</data>
<data key="password_confirmation">1234512345q!</data>
<data key="interface_local">en_US</data>
<data key="interface_local_label">English (United States)</data>
<data key="is_active">true</data>
Expand All @@ -150,8 +150,8 @@
<data key="firstname" unique="suffix">FirstName</data>
<data key="lastname" unique="suffix">LastName</data>
<data key="email" unique="prefix">admin@example.com</data>
<data key="password">123123q</data>
<data key="password_confirmation">123123q</data>
<data key="password">1234512345q!</data>
<data key="password_confirmation">1234512345q!</data>
<data key="interface_local">en_US</data>
<data key="interface_local_label">English (United States)</data>
<data key="current_password">{{_ENV.MAGENTO_ADMIN_PASSWORD}}</data>
Expand All @@ -166,8 +166,8 @@
<data key="firstname" unique="suffix">FirstName</data>
<data key="lastname" unique="suffix">LastName</data>
<data key="email" unique="prefix">admin@example.com</data>
<data key="password">123123q</data>
<data key="password_confirmation">123123q</data>
<data key="password">1234512345q!</data>
<data key="password_confirmation">1234512345q!</data>
<data key="interface_local">en_US</data>
<data key="interface_local_label">English (United States)</data>
<data key="current_password">{{_ENV.MAGENTO_ADMIN_PASSWORD}}</data>
Expand All @@ -188,8 +188,8 @@
<data key="firstname">John</data>
<data key="lastname">Doe</data>
<data key="email" unique="prefix">admin@example.com</data>
<data key="password">123123QA</data>
<data key="password_confirmation">123123QA</data>
<data key="password">1234512345q!</data>
<data key="password_confirmation">1234512345q!</data>
<data key="current_password">{{_ENV.MAGENTO_ADMIN_PASSWORD}}</data>
<data key="role">Administrators</data>
<array key="roles">
Expand All @@ -201,8 +201,8 @@
<data key="firstname">John</data>
<data key="lastname">Doe</data>
<data key="email" unique="prefix">admin@example.com</data>
<data key="password">123123UPD</data>
<data key="password_confirmation">123123UPD</data>
<data key="password">1234512345q!</data>
<data key="password_confirmation">1234512345q!</data>
<data key="current_password">{{_ENV.MAGENTO_ADMIN_PASSWORD}}</data>
<array key="roles">
<item>1</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,19 @@ public static function executeDataProvider()
{
return [
[
'currentUserPassword' => '123123q',
'currentUserPassword' => '1234512345q!',
'userId' => 1,
'currentUserId' => 2,
'resultMethod' => 'addSuccess',
],
[
'currentUserPassword' => '123123q',
'currentUserPassword' => '1234512345q!',
'userId' => 0,
'currentUserId' => 2,
'resultMethod' => 'addError',
],
[
'currentUserPassword' => '123123q',
'currentUserPassword' => '1234512345q!',
'userId' => 1,
'currentUserId' => 1,
'resultMethod' => 'addError',
Expand Down
6 changes: 3 additions & 3 deletions dev/tests/api-functional/config/install-config-mysql.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/**
* Magento console installer options for Web API functional tests. Are used in functional tests bootstrap.
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2015 Adobe
* All Rights Reserved.
*/
return [
'language' => 'en_US',
Expand All @@ -21,7 +21,7 @@ return [
'admin-firstname' => 'Admin',
'admin-email' => 'admin@example.com',
'admin-user' => 'admin',
'admin-password' => '123123q',
'admin-password' => '1234512345q!',
'admin-use-security-key' => '0',
/* PayPal has limitation for order number - 20 characters. 10 digits prefix + 8 digits number is good enough */
'sales-order-increment-prefix' => time(),
Expand Down
6 changes: 3 additions & 3 deletions dev/tests/integration/etc/install-config-mysql.php.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2011 Adobe
* All Rights Reserved.
*/

return [
'db-host' => 'localhost',
'db-user' => 'root',
'db-password' => '123123q',
'db-password' => '1234512345q!',
'db-name' => 'magento_integration_tests',
'db-prefix' => '',
'backend-frontname' => 'backend',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2011 Adobe
* All Rights Reserved.
*/

namespace Magento\TestFramework;
Expand All @@ -15,7 +15,7 @@ class Bootstrap
* Predefined admin user credentials
*/
public const ADMIN_NAME = 'user';
public const ADMIN_PASSWORD = 'password1';
public const ADMIN_PASSWORD = 'password1234';
public const ADMIN_EMAIL = 'admin@example.com';
public const ADMIN_FIRSTNAME = 'firstname';
public const ADMIN_LASTNAME = 'lastname';
Expand Down
10 changes: 5 additions & 5 deletions dev/tests/integration/testsuite/Magento/User/Model/UserTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright 2015 Adobe
* Copyright 2012 Adobe
* All Rights Reserved.
*/

Expand Down Expand Up @@ -394,11 +394,11 @@ public function testBeforeSavePasswordHash()
)->setEmail(
'jdoe@example.com'
)->setPassword(
'123123q'
'1234512345q!'
);
$this->_model->save();
$this->assertStringNotContainsString(
'123123q',
'1234512345q!',
$this->_model->getPassword(),
'Password is expected to be hashed'
);
Expand Down Expand Up @@ -488,9 +488,9 @@ public function testBeforeSaveValidationSuccess()
)->setEmail(
'jdoe@example.com'
)->setPassword(
'1234abc'
'1234512345q!'
)->setPasswordConfirmation(
'1234abc'
'1234512345q!'
);
$this->_model->save();
}
Expand Down
2 changes: 1 addition & 1 deletion dev/tests/js/jasmine/tests/lib/mage/validation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ define([
expect($.validator.methods['validate-admin-password']
.call($.validator.prototype, ' ')).toEqual(true);
expect($.validator.methods['validate-admin-password']
.call($.validator.prototype, '123@123.com')).toEqual(true);
.call($.validator.prototype, '1234@123.com')).toEqual(true);
expect($.validator.methods['validate-admin-password']
.call($.validator.prototype, 'abc')).toEqual(false);
expect($.validator.methods['validate-admin-password']
Expand Down
6 changes: 3 additions & 3 deletions dev/tests/setup-integration/etc/install-config-mysql.php.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2017 Adobe
* All Rights Reserved.
*/

return [
Expand All @@ -14,7 +14,7 @@ return [
'db-prefix' => '',
'backend-frontname' => 'admin',
'admin-user' => 'admin',
'admin-password' => '123123q',
'admin-password' => '1234512345q!',
'admin-email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL,
'admin-firstname' => \Magento\TestFramework\Bootstrap::ADMIN_FIRSTNAME,
'admin-lastname' => \Magento\TestFramework\Bootstrap::ADMIN_LASTNAME,
Expand Down
8 changes: 4 additions & 4 deletions lib/web/mage/validation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2012 Adobe
* All Rights Reserved.
*/

define([
Expand Down Expand Up @@ -685,13 +685,13 @@ define([
return false;
}

if (pass.length < 7) {
if (pass.length < 12) {
return false;
}

return true;
},
$.mage.__('Please enter 7 or more characters, using both numeric and alphabetic.')
$.mage.__('Please enter 12 or more characters, using both numeric and alphabetic.')
],
'validate-customer-password': [
function (v, elm) {
Expand Down
Loading