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