- protected function verifyAuthCode($host, $code, $state, $redirect_uri, $me)
- {
- $req = new \HTTP_Request2($host->endpoints->authorization, 'POST');
- $req->setHeader('Content-Type: application/x-www-form-urlencoded');
- $req->setBody(
- http_build_query(
- [
- 'code' => $code,
- 'state' => $state,
- 'client_id' => static::$client_id,
- 'redirect_uri' => $redirect_uri,
- ]
- )
- );
- $res = $req->send();
- if ($res->getHeader('content-type') != 'application/x-www-form-urlencoded') {
- Log::err('Wrong content type in auth verification response');
- exit(2);
+ if (isset($_SERVER['SSH_CONNECTION'])) {
+ $parts = explode(' ', $_SERVER['SSH_CONNECTION']);
+ if (count($parts) >= 3) {
+ $ip = $parts[2];
+ }