Skip to content

Commit c86ba9a

Browse files
committed
MC-33699: Stabilize MFTF tests
1 parent 47f907f commit c86ba9a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/code/Magento/User/Observer/Backend/AuthObserver.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,17 @@ private function _updateLockingInformation($user)
167167
$failuresNum = (int)$user->getFailuresNum() + 1;
168168
/** @noinspection PhpAssignmentInConditionInspection */
169169
if ($firstFailureDate = $user->getFirstFailure()) {
170-
$firstFailureDate = strtotime($user->getFirstFailure());
170+
$firstFailureDate = new \DateTime($firstFailureDate);
171171
}
172172

173173
$newFirstFailureDate = false;
174174
$updateLockExpires = false;
175175
$lockThreshInterval = new \DateInterval('PT' . $lockThreshold.'S');
176176
// set first failure date when this is first failure or last first failure expired
177-
if (1 === $failuresNum || !$firstFailureDate || ($now->getTimestamp() - $firstFailureDate) > $lockThreshold) {
177+
if (1 === $failuresNum
178+
|| !$firstFailureDate
179+
|| ($now->getTimestamp() - $firstFailureDate->getTimestamp()) > $lockThreshold
180+
) {
178181
$newFirstFailureDate = $now;
179182
// otherwise lock user
180183
} elseif ($failuresNum >= $maxFailures) {

0 commit comments

Comments
 (0)