@@ 262-276 (lines=15) @@ | ||
259 | } |
|
260 | $this->setErrorMessage("Invalid username or password"); |
|
261 | $this->log->log('error', "Authentication failed for $username"); |
|
262 | if ($id = $this->getUserId($username)) { |
|
263 | $this->incUserFailed($id); |
|
264 | // Check if this account should be locked |
|
265 | if (isset($this->config['maxfailed']['login']) && $this->getUserFailed($id) >= $this->config['maxfailed']['login']) { |
|
266 | $this->setLocked($id, 1); |
|
267 | $this->log->log("warn", "$username locked due to failed logins, saved is [".$this->getUserIp($this->getUserId($username))."]"); |
|
268 | if ($token = $this->token->createToken('account_unlock', $id)) { |
|
269 | $aData['token'] = $token; |
|
270 | $aData['username'] = $username; |
|
271 | $aData['email'] = $this->getUserEmail($username); |
|
272 | $aData['subject'] = 'Account auto-locked'; |
|
273 | $this->mail->sendMail('notifications/locked', $aData); |
|
274 | } |
|
275 | } |
|
276 | } |
|
277 | ||
278 | return false; |
|
279 | } |
|
@@ 302-314 (lines=13) @@ | ||
299 | $this->log->log('info', $this->getUserName($userId).' incorrect pin'); |
|
300 | $this->incUserPinFailed($userId); |
|
301 | // Check if this account should be locked |
|
302 | if (isset($this->config['maxfailed']['pin']) && $this->getUserPinFailed($userId) >= $this->config['maxfailed']['pin']) { |
|
303 | $this->setLocked($userId, 1); |
|
304 | $this->log->log("warn", $this->getUserName($userId)." was locked due to incorrect pins"); |
|
305 | if ($token = $this->token->createToken('account_unlock', $userId)) { |
|
306 | $username = $this->getUserName($userId); |
|
307 | $aData['token'] = $token; |
|
308 | $aData['username'] = $username; |
|
309 | $aData['email'] = $this->getUserEmail($username); |
|
310 | $aData['subject'] = 'Account auto-locked'; |
|
311 | $this->mail->sendMail('notifications/locked', $aData); |
|
312 | } |
|
313 | $this->logoutUser(); |
|
314 | } |
|
315 | return false; |
|
316 | } |
|
317 |