@@ -46,27 +46,41 @@ public function __construct(
46
46
}
47
47
48
48
/**
49
- * { @inheritdoc}
49
+ * @inheritdoc
50
50
*/
51
51
protected function _construct ()
52
52
{
53
53
$ this ->_init ('oauth_token_request_log ' , 'entity_id ' );
54
54
}
55
55
56
56
/**
57
- * {@inheritdoc}
57
+ * @inheritdoc
58
+ * @param string $userName
59
+ * @param int $userType
58
60
*/
59
61
public function getFailuresCount ($ userName , $ userType )
60
62
{
63
+ $ date = (new \DateTime ())->setTimestamp ($ this ->dateTime ->gmtTimestamp ());
64
+ $ dateTime = $ date ->format (\Magento \Framework \Stdlib \DateTime::DATETIME_PHP_FORMAT );
65
+
61
66
$ select = $ this ->getConnection ()->select ();
62
67
$ select ->from ($ this ->getMainTable (), 'failures_count ' )
63
- ->where ('user_name = :user_name AND user_type = :user_type ' );
68
+ ->where ('user_name = :user_name AND user_type = :user_type AND lock_expires_at > :expiration_time ' );
64
69
65
- return (int )$ this ->getConnection ()->fetchOne ($ select , ['user_name ' => $ userName , 'user_type ' => $ userType ]);
70
+ return (int )$ this ->getConnection ()->fetchOne (
71
+ $ select ,
72
+ [
73
+ 'user_name ' => $ userName ,
74
+ 'user_type ' => $ userType ,
75
+ 'expiration_time ' => $ dateTime ,
76
+ ]
77
+ );
66
78
}
67
79
68
80
/**
69
- * {@inheritdoc}
81
+ * @inheritdoc
82
+ * @param string $userName
83
+ * @param int $userType
70
84
*/
71
85
public function resetFailuresCount ($ userName , $ userType )
72
86
{
@@ -77,7 +91,9 @@ public function resetFailuresCount($userName, $userType)
77
91
}
78
92
79
93
/**
80
- * {@inheritdoc}
94
+ * @inheritdoc
95
+ * @param string $userName
96
+ * @param int $userType
81
97
*/
82
98
public function incrementFailuresCount ($ userName , $ userType )
83
99
{
@@ -101,7 +117,7 @@ public function incrementFailuresCount($userName, $userType)
101
117
}
102
118
103
119
/**
104
- * { @inheritdoc}
120
+ * @inheritdoc
105
121
*/
106
122
public function clearExpiredFailures ()
107
123
{
0 commit comments