[ADDED] Account unlock mail on failed PIN

This commit is contained in:
Sebastian Grewe 2014-01-02 13:28:33 +01:00
parent 878fa1c1c8
commit 8fcd59eeea

View File

@ -143,8 +143,7 @@ class User extends Base {
$aData['username'] = $username; $aData['username'] = $username;
$aData['email'] = $this->getUserEmail($username);; $aData['email'] = $this->getUserEmail($username);;
$aData['subject'] = 'Account auto-locked'; $aData['subject'] = 'Account auto-locked';
if (!$this->mail->sendMail('notifications/locked', $aData)) $this->mail->sendMail('notifications/locked', $aData);
return false;
} }
} }
} }
@ -171,12 +170,20 @@ class User extends Base {
// Check if this account should be locked // Check if this account should be locked
if (isset($this->config['maxfailed']['pin']) && $this->getUserPinFailed($userId) >= $this->config['maxfailed']['pin']) { if (isset($this->config['maxfailed']['pin']) && $this->getUserPinFailed($userId) >= $this->config['maxfailed']['pin']) {
$this->changeLocked($userId); $this->changeLocked($userId);
if ($token = $this->token->createToken('account_unlock', $userId)) {
$username = $this->getUserName($userId);
$aData['token'] = $token;
$aData['username'] = $username;
$aData['email'] = $this->getUserEmail($username);;
$aData['subject'] = 'Account auto-locked';
$this->mail->sendMail('notifications/locked', $aData);
}
$this->logoutUser(); $this->logoutUser();
} }
return false; return false;
} }
public function generatePin($userID, $current) { public function generatePin($userID, $current) {
$this->debug->append("STA " . __METHOD__, 4); $this->debug->append("STA " . __METHOD__, 4);
$username = $this->getUserName($userID); $username = $this->getUserName($userID);
$email = $this->getUserEmail($username); $email = $this->getUserEmail($username);