Skip to content
Snippets Groups Projects
Commit 43c60ec2 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix error management at wrong place

parent cf274a7e
No related branches found
No related tags found
No related merge requests found
......@@ -106,6 +106,10 @@ if ($action == 'delete')
if (! empty($_GET['code'])) // We are coming from oauth provider page
{
// We should have
//$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16))
dol_syslog("We are coming fr mthe oauth provider page");
//llxHeader('',$langs->trans("OAuthSetup"));
//$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
......@@ -124,21 +128,21 @@ if (! empty($_GET['code'])) // We are coming from oauth provider page
//$token = $apiService->requestAccessToken($_GET['code'], $state);
$token = $apiService->requestAccessToken($_GET['code']);
// Github is a service that does not need state yo be stored.
// Github is a service that does not need state to be stored.
// Into constructor of GitHub, the call
// parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri)
// has not the ending parameter to true like the Google class constructor.
setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
} catch (Exception $e) {
print $e->getMessage();
}
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
header('Location: ' . $backtourl);
exit();
} catch (Exception $e) {
print $e->getMessage();
}
}
else // If entry on page with no parameter, we arrive here
{
......
......@@ -109,6 +109,7 @@ if ($action == 'delete')
if (! empty($_GET['code'])) // We are coming from oauth provider page
{
dol_syslog("We are coming fr mthe oauth provider page");
//llxHeader('',$langs->trans("OAuthSetup"));
//$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
......@@ -128,15 +129,15 @@ if (! empty($_GET['code'])) // We are coming from oauth provider page
$token = $apiService->requestAccessToken($_GET['code'], $state);
setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
} catch (Exception $e) {
print $e->getMessage();
}
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
header('Location: ' . $backtourl);
exit();
} catch (Exception $e) {
print $e->getMessage();
}
}
else // If entry on page with no parameter, we arrive here
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment