mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
Merge remote-tracking branch 'origin/support/3.0' into develop
This commit is contained in:
@@ -21,6 +21,7 @@ Dict::Add('EN US', 'English', 'English', [
|
|||||||
'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client',
|
'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client',
|
||||||
'itop-oauth-client:Message:TokenCreated' => 'Access token created',
|
'itop-oauth-client:Message:TokenCreated' => 'Access token created',
|
||||||
'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated',
|
'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated',
|
||||||
|
'itop-oauth-client:Message:TokenError' => 'Access token not generated due to server error',
|
||||||
|
|
||||||
'OAuthClient:Name/UseForSMTPMustBeUnique' => 'The combination Login (%1$s) and Use for SMTP (%2$s) has already be used for OAuth Client',
|
'OAuthClient:Name/UseForSMTPMustBeUnique' => 'The combination Login (%1$s) and Use for SMTP (%2$s) has already be used for OAuth Client',
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Dict::Add('FR FR', 'French', 'Français', [
|
|||||||
'itop-oauth-client:Message:MissingToken' => 'Générez le jeton d\'accès avant d\'utiliser ce client OAuth',
|
'itop-oauth-client:Message:MissingToken' => 'Générez le jeton d\'accès avant d\'utiliser ce client OAuth',
|
||||||
'itop-oauth-client:Message:TokenCreated' => 'Le jeton d\'accès à été créé',
|
'itop-oauth-client:Message:TokenCreated' => 'Le jeton d\'accès à été créé',
|
||||||
'itop-oauth-client:Message:TokenRecreated' => 'Le jeton d\'accès à été renouvelé',
|
'itop-oauth-client:Message:TokenRecreated' => 'Le jeton d\'accès à été renouvelé',
|
||||||
|
'itop-oauth-client:Message:TokenError' => 'Le jeton d\'accès n\'a pas été généré à cause d`une erreur serveur',
|
||||||
|
|
||||||
'OAuthClient:Name/UseForSMTPMustBeUnique' => 'La combinaison Login (%1$s) and Utilisé pour SMTP (%2$s) a déjà été utilisée pour OAuth Client',
|
'OAuthClient:Name/UseForSMTPMustBeUnique' => 'La combinaison Login (%1$s) and Utilisé pour SMTP (%2$s) a déjà été utilisée pour OAuth Client',
|
||||||
|
|
||||||
|
|||||||
@@ -49,15 +49,36 @@ class AjaxOauthClientController extends Controller
|
|||||||
|
|
||||||
$sRedirectUrl = utils::ReadParam('redirect_url', '', false, 'raw');
|
$sRedirectUrl = utils::ReadParam('redirect_url', '', false, 'raw');
|
||||||
|
|
||||||
$sRedirectUrlQuery = parse_url($sRedirectUrl)['query'];
|
$aResult = [];
|
||||||
|
$aResult['status'] = 'error';
|
||||||
|
$aURL = parse_url($sRedirectUrl);
|
||||||
|
if (isset($aURL['query'])) {
|
||||||
|
$sRedirectUrlQuery = $aURL['query'];
|
||||||
$aQuery = [];
|
$aQuery = [];
|
||||||
parse_str($sRedirectUrlQuery, $aQuery);
|
parse_str($sRedirectUrlQuery, $aQuery);
|
||||||
|
if (isset($aQuery['error'])) {
|
||||||
|
$aResult['status'] = 'error';
|
||||||
|
if (isset($aQuery['error_description'])) {
|
||||||
|
$aResult['error_description'] = $aQuery['error_description'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($aQuery['code'])) {
|
||||||
$sCode = $aQuery['code'];
|
$sCode = $aQuery['code'];
|
||||||
$oAccessToken = OAuthClientProviderFactory::GetAccessTokenFromCode($oOAuthClient, $sCode);
|
$oAccessToken = OAuthClientProviderFactory::GetAccessTokenFromCode($oOAuthClient, $sCode);
|
||||||
|
|
||||||
$oOAuthClient->SetAccessToken($oAccessToken);
|
$oOAuthClient->SetAccessToken($oAccessToken);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$aResult['status'] = 'success';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$aResult['status'] = 'error';
|
||||||
|
$aResult['error_description'] = 'Redirect URL Format not recognized';
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($aResult['status']) {
|
||||||
|
case 'success':
|
||||||
cmdbAbstractObject::SetSessionMessage(
|
cmdbAbstractObject::SetSessionMessage(
|
||||||
$sClass,
|
$sClass,
|
||||||
$sId,
|
$sId,
|
||||||
@@ -67,8 +88,27 @@ class AjaxOauthClientController extends Controller
|
|||||||
1,
|
1,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
if ($bIsCreation) {
|
||||||
|
IssueLog::Info("Token created for $sClass:$sId");
|
||||||
|
} else {
|
||||||
|
IssueLog::Info("Token recreated for $sClass:$sId");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'error':
|
||||||
|
cmdbAbstractObject::SetSessionMessage(
|
||||||
|
$sClass,
|
||||||
|
$sId,
|
||||||
|
"$sClass:$sId:TokenError",
|
||||||
|
$aResult['error_description'] ?? Dict::S('itop-oauth-client:Message:TokenError'),
|
||||||
|
'error',
|
||||||
|
1,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
IssueLog::Error("Token creation failed for $sClass:$sId", null, $aResult);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$aResult = ['status' => 'success'];
|
|
||||||
$aResult['data'] = utils::GetAbsoluteUrlAppRoot()."pages/UI.php?operation=details&class=$sClass&id=$sId";
|
$aResult['data'] = utils::GetAbsoluteUrlAppRoot()."pages/UI.php?operation=details&class=$sClass&id=$sId";
|
||||||
|
|
||||||
$this->DisplayJSONPage($aResult);
|
$this->DisplayJSONPage($aResult);
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ class OAuthLandingController extends Controller
|
|||||||
{
|
{
|
||||||
public function OperationLanding()
|
public function OperationLanding()
|
||||||
{
|
{
|
||||||
$this->DisplayPage([]);
|
$this->DisplayAjaxPage([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user