diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index c69493ed9a554dc5988a53361387c0797846d741..001db7320a0ec69c45252f12ace2633492a33cce 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -84,8 +84,11 @@ if ($action != 'delete' && empty($requestedpermissionsarray)) $apiService = $serviceFactory->createService('Google', $credentials, $storage, $requestedpermissionsarray); // access type needed to have oauth provider refreshing token +// alos note that a refresh token is sent only after a prompt $apiService->setAccessType('offline'); +$apiService->setApprouvalPrompt('force'); + $langs->load("oauth"); diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index baa5106ae93b81f7c2791d88fce7391fd55b6bc0..ebcb9f3cebf2574cd891964df9b3c2ea2d371752 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -450,6 +450,7 @@ class printing_printgcp extends PrintingDriver } $responsedata = json_decode($response, true); //$html .= '<pre>'.print_r($responsedata,true).'</pre>'; + $html .= '<div class="div-table-responsive">'; $html .= '<table width="100%" class="noborder">'; $html .= '<tr class="liste_titre">'; $html .= '<td>'.$langs->trans("Id").'</td>'; @@ -483,10 +484,11 @@ class printing_printgcp extends PrintingDriver else { $html .= '<tr '.$bc[$var].'>'; - $html .= '<td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td>'; + $html .= '<td colspan="7" class="opacitymedium">'.$langs->trans("None").'</td>'; $html .= '</tr>'; } $html .= '</table>'; + $html .= '</div>'; $this->resprint = $html; diff --git a/htdocs/includes/OAuth/OAuth2/Service/Google.php b/htdocs/includes/OAuth/OAuth2/Service/Google.php index a8bb44d8238420d78a6c724c7b7eeda949790b6c..0d49609dccbc5892981acc12078826915244474a 100644 --- a/htdocs/includes/OAuth/OAuth2/Service/Google.php +++ b/htdocs/includes/OAuth/OAuth2/Service/Google.php @@ -140,12 +140,25 @@ class Google extends AbstractService $this->accessType = $accessType; } + // LDR CHANGE Add approval_prompt to force the prompt if value is set to 'force' so it force return of a "refresh token" in addition to "standard token" + public $approvalPrompt='auto'; + public function setApprouvalPrompt($prompt) + { + if (!in_array($prompt, array('auto', 'force'), true)) { + // @todo Maybe could we rename this exception + throw new InvalidAccessTypeException('Invalid approuvalPrompt, expected either auto or force.'); + } + $this->approvalPrompt = $prompt; + } + /** * {@inheritdoc} */ public function getAuthorizationEndpoint() { - return new Uri('https://accounts.google.com/o/oauth2/auth?access_type=' . $this->accessType); + // LDR CHANGE Add approval_prompt to force the prompt if value is set to 'force' so it force return of a "refresh token" in addition to "standard token" + //return new Uri('https://accounts.google.com/o/oauth2/auth?access_type='.$this->accessType); + return new Uri('https://accounts.google.com/o/oauth2/auth?'.($this->approvalPrompt?'approval_prompt='.$this->approvalPrompt.'&':'').'access_type='.$this->accessType); } /**