Skip to content

Commit 269560f

Browse files
author
robin.kluth
committed
* Fix wrong return value for failed detection
* Using now Yii's IP detection method (supports `FORWARDED_FOR` as well)
1 parent 7fecb65 commit 269560f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/LdapAuth.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ public function autoDetect($overrideIp = false)
9292
return 0;
9393
}
9494

95-
$clientIp = $overrideIp ? $overrideIp : (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null));
95+
$clientIp = $overrideIp ? $overrideIp : Yii::$app->request->getUserIP();
9696

9797
if (empty($clientIp)) {
9898
Yii::debug('[Autodetect] No client ip detected, skipping auto detection', __METHOD__);
99-
return 0;
99+
return false;
100100
}
101101

102102
$index = 0;

0 commit comments

Comments
 (0)