FIX: Mas registro de login desde cli
This commit is contained in:
@ -29,6 +29,12 @@ class Login
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($response->getStatusCode() !== 200) {
|
if ($response->getStatusCode() !== 200) {
|
||||||
|
$this->logger->error('Login failed', [
|
||||||
|
'statusCode' => $response->getStatusCode(),
|
||||||
|
'body' => $response->getBody()->getContents(),
|
||||||
|
'username' => $this->username,
|
||||||
|
'headers' => $response->getHeaders()
|
||||||
|
]);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$body = $response->getBody()->getContents();
|
$body = $response->getBody()->getContents();
|
||||||
@ -68,8 +74,12 @@ class Login
|
|||||||
throw new Exception('Token not valid');
|
throw new Exception('Token not valid');
|
||||||
}
|
}
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
$this->logger->error($exception);
|
$this->logger->notice($exception);
|
||||||
$token = $this->login();
|
$token = $this->login();
|
||||||
|
if ($token === '') {
|
||||||
|
unlink($this->tokenFilename);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return implode('', [md5($apiKey), $separator, $token]);
|
return implode('', [md5($apiKey), $separator, $token]);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user