diff --git a/application/models/FailedLoginAttempt.php b/application/models/FailedLoginAttempt.php index 7667e06f267..b0902b12d5e 100644 --- a/application/models/FailedLoginAttempt.php +++ b/application/models/FailedLoginAttempt.php @@ -57,7 +57,7 @@ public function tableName() */ public function deleteAttempts() { - $ip = substr(App()->getRequest()->getUserHostAddress(), 0, 40); + $ip = substr(getIPAddress(), 0, 40); $this->deleteAllByAttributes(array('ip' => $ip)); } @@ -71,7 +71,7 @@ public function deleteAttempts() public function isLockedOut($attemptType = '') { $isLockedOut = false; - $ip = substr($_SERVER['REMOTE_ADDR'], 0, 40); + $ip = substr(getIPAddress(), 0, 40); // Return false if IP is whitelisted if (!empty($attemptType) && $this->isWhitelisted($ip, $attemptType)) { @@ -116,7 +116,7 @@ public function addAttempt() { if (!$this->isLockedOut()) { $timestamp = date("Y-m-d H:i:s"); - $ip = substr(App()->getRequest()->getUserHostAddress(), 0, 40); + $ip = substr(getIPAddress(), 0, 40); $row = $this->findByAttributes(array('ip' => $ip)); if ($row !== null) {