mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-07 18:18:18 +01:00
Fix error management at wrong place
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user