login failed
This commit is contained in:
@@ -142,31 +142,34 @@ abstract class BaseController extends Controller
|
||||
curl_close($ch);
|
||||
|
||||
if ($httpcode != "204") {
|
||||
return "Login failed! $result";
|
||||
}
|
||||
log_message('critical', "***** ***** Provision LOGIN COMPLETED :: NOW TOKEN :: " );
|
||||
# 2. Get token
|
||||
$url = $base_url . "/api/user/tokens";
|
||||
$url = $base_url . "/user/tokens";
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies);
|
||||
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies);
|
||||
$result = curl_exec($ch);
|
||||
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
log_message('critical', "***** ***** Provision LOGIN FAILED*********** :: " . $result);
|
||||
//return '';
|
||||
} else {
|
||||
log_message('critical', "***** ***** Provision LOGIN COMPLETED :: NOW TOKEN :: ");
|
||||
# 2. Get token
|
||||
$url = $base_url . "/api/user/tokens";
|
||||
$url = $base_url . "/user/tokens";
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies);
|
||||
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies);
|
||||
$result = curl_exec($ch);
|
||||
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
$token = null;
|
||||
$arr = json_decode($result, true);
|
||||
foreach ($arr as $item) {
|
||||
if ($item["expired"] === false) {
|
||||
$token = $item["id"];
|
||||
break;
|
||||
$token = null;
|
||||
$arr = json_decode($result, true);
|
||||
foreach ($arr as $item) {
|
||||
if ($item["expired"] === false) {
|
||||
$token = $item["id"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$result = "Found token: $token";
|
||||
# Print response.
|
||||
log_message('critical', "***** ***** Provision LOGIN TOKEN :: " . $token);
|
||||
}
|
||||
$result = "Found token: $token";
|
||||
# Print response.
|
||||
log_message('critical', "***** ***** Provision LOGIN TOKEN :: " . $token);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
log_message('critical', "***** ***** Provision LOGIN FAILED :: " . $e->getMessage());
|
||||
}
|
||||
@@ -218,7 +221,7 @@ abstract class BaseController extends Controller
|
||||
$result .= "\n" . 'Get tasks HTTP code: ' . $httpcode;
|
||||
|
||||
curl_close($ch);
|
||||
log_message('critical', "***** ***** Provision :: ansibleProvision(httpcode) ".$httpcode);
|
||||
log_message('critical', "***** ***** Provision :: ansibleProvision(httpcode) " . $httpcode);
|
||||
ob_start();
|
||||
var_dump($headers);
|
||||
var_dump($res);
|
||||
|
||||
Reference in New Issue
Block a user