support login token

This commit is contained in:
Michael Becker 2024-12-17 00:50:02 -05:00
parent 368d3e576f
commit 2a964d1b5c
3 changed files with 13 additions and 13 deletions

View File

@ -384,14 +384,10 @@
return null; return null;
} }
public function processElement(InstanceReference $element, array $values) : array | bool public function processElement(InstanceReference $element, array $values) : array
{ {
$result = $this->curl_request_json("/tenants/" . $this->getTenantName() . "/instances/" . $element->GlobalIdentifier . "/element", HttpRequestMethod::POST, $values); $result = $this->curl_request_json("/tenants/" . $this->getTenantName() . "/instances/" . $element->GlobalIdentifier . "/element", HttpRequestMethod::POST, $values);
if ($result["result"] == "success") return $result;
{
return $result;
}
return false;
} }
public function getRelatedTasks(InstanceReference $inst) public function getRelatedTasks(InstanceReference $inst)

View File

@ -35,7 +35,7 @@
} }
$array = $this->OMS->processElement($element, $values); $array = $this->OMS->processElement($element, $values);
if ($array === false) if ($array["result"] === "failure")
{ {
return false; return false;
} }

View File

@ -106,18 +106,20 @@
$renderer->ProcessPostbackFunction = function($sender, $element, $array) $renderer->ProcessPostbackFunction = function($sender, $element, $array)
{ {
$oms = mocha_get_oms(); $oms = mocha_get_oms();
if ($array["result"] == "success") if ($array["result"] == "success")
{ {
if (array_key_exists("sessionSecureToken", $array)) if (array_key_exists("sessionSecureToken", $array))
{ {
// update token if we have
$token = $array["sessionSecureToken"]; $token = $array["sessionSecureToken"];
$_SESSION["user_token_" . System::GetTenantName()] = $token; $_SESSION["user_token_" . System::GetTenantName()] = $token;
if ($array["type"] == "redirect") }
{
System::Redirect($array["destinationUrl"]); if ($array["type"] == "redirect")
return false; {
} // response redirect
System::Redirect($array["destinationUrl"]);
return false;
} }
} }
}; };
@ -182,6 +184,8 @@
$_SESSION["user_token_" . System::GetTenantName()] = $token; $_SESSION["user_token_" . System::GetTenantName()] = $token;
$oms->setCurrentUser($instUser); $oms->setCurrentUser($instUser);
echo ($_SESSION["user_token_" . System::GetTenantName()]); die();
System::RedirectFromLoginPage(); System::RedirectFromLoginPage();
exit(); exit();
} }