Skip to content

Commit 432fbcd

Browse files
committed
MAGETWO-68794: Password policy does not work correctly
- Fixed failed static tests
1 parent 053c880 commit 432fbcd

File tree

1 file changed

+55
-49
lines changed

1 file changed

+55
-49
lines changed

app/code/Magento/User/Setup/UpgradeSchema.php

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
namespace Magento\User\Setup;
87

8+
use Magento\Framework\DB\Ddl\Table;
99
use Magento\Framework\Setup\ModuleContextInterface;
1010
use Magento\Framework\Setup\SchemaSetupInterface;
1111
use Magento\Framework\Setup\UpgradeSchemaInterface;
@@ -45,7 +45,7 @@ private function addFailuresToAdminUserTable(SchemaSetupInterface $setup)
4545
$tableAdmins,
4646
'failures_num',
4747
[
48-
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
48+
'type' => Table::TYPE_SMALLINT,
4949
'nullable' => true,
5050
'default' => 0,
5151
'comment' => 'Failure Number'
@@ -55,15 +55,15 @@ private function addFailuresToAdminUserTable(SchemaSetupInterface $setup)
5555
$tableAdmins,
5656
'first_failure',
5757
[
58-
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
58+
'type' => Table::TYPE_TIMESTAMP,
5959
'comment' => 'First Failure'
6060
]
6161
);
6262
$setup->getConnection()->addColumn(
6363
$tableAdmins,
6464
'lock_expires',
6565
[
66-
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
66+
'type' => Table::TYPE_TIMESTAMP,
6767
'comment' => 'Expiration Lock Dates'
6868
]
6969
);
@@ -81,57 +81,63 @@ private function createAdminPasswordsTable(SchemaSetupInterface $setup)
8181
return;
8282
}
8383

84-
$table = $setup->getConnection()->newTable(
85-
$setup->getTable('admin_passwords')
86-
)->addColumn(
87-
'password_id',
88-
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
89-
null,
90-
['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
91-
'Password Id'
92-
)->addColumn(
93-
'user_id',
94-
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
95-
null,
96-
['unsigned' => true, 'nullable' => false, 'default' => '0'],
97-
'User Id'
98-
)->addColumn(
99-
'password_hash',
100-
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
101-
100,
102-
[],
103-
'Password Hash'
104-
)->addColumn(
105-
'expires',
106-
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
107-
null,
108-
['unsigned' => true, 'nullable' => false, 'default' => '0'],
109-
'Deprecated'
110-
)->addColumn(
111-
'last_updated',
112-
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
113-
null,
114-
['unsigned' => true, 'nullable' => false, 'default' => '0'],
115-
'Last Updated'
116-
)->addIndex(
117-
$setup->getIdxName('admin_passwords', ['user_id']),
118-
['user_id']
119-
)->addForeignKey(
120-
$setup->getFkName('admin_passwords', 'user_id', 'admin_user', 'user_id'),
121-
'user_id',
122-
$setup->getTable('admin_user'),
123-
'user_id',
124-
\Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
125-
)->setComment(
126-
'Admin Passwords'
127-
);
84+
$table = $setup->getConnection()
85+
->newTable($setup->getTable('admin_passwords'))
86+
->addColumn(
87+
'password_id',
88+
Table::TYPE_INTEGER,
89+
null,
90+
['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
91+
'Password Id'
92+
)
93+
->addColumn(
94+
'user_id',
95+
Table::TYPE_INTEGER,
96+
null,
97+
['unsigned' => true, 'nullable' => false, 'default' => '0'],
98+
'User Id'
99+
)
100+
->addColumn(
101+
'password_hash',
102+
Table::TYPE_TEXT,
103+
100,
104+
[],
105+
'Password Hash'
106+
)
107+
->addColumn(
108+
'expires',
109+
Table::TYPE_INTEGER,
110+
null,
111+
['unsigned' => true, 'nullable' => false, 'default' => '0'],
112+
'Deprecated'
113+
)
114+
->addColumn(
115+
'last_updated',
116+
Table::TYPE_INTEGER,
117+
null,
118+
['unsigned' => true, 'nullable' => false, 'default' => '0'],
119+
'Last Updated'
120+
)
121+
->addIndex(
122+
$setup->getIdxName('admin_passwords', ['user_id']),
123+
['user_id']
124+
)
125+
->addForeignKey(
126+
$setup->getFkName('admin_passwords', 'user_id', 'admin_user', 'user_id'),
127+
'user_id',
128+
$setup->getTable('admin_user'),
129+
'user_id',
130+
Table::ACTION_CASCADE
131+
)
132+
->setComment('Admin Passwords');
133+
128134
$setup->getConnection()->createTable($table);
129135

130136
$setup->getConnection()->modifyColumn(
131137
$setup->getTable('admin_passwords'),
132138
'expires',
133139
[
134-
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
140+
'type' => Table::TYPE_INTEGER,
135141
'unsigned' => true,
136142
'nullable' => false,
137143
'default' => '0',

0 commit comments

Comments
 (0)