Look and feel v11

This commit is contained in:
Laurent Destailleur 2019-12-16 21:06:32 +01:00
parent a3fa6eb473
commit 6e2e02fd40
3 changed files with 11 additions and 6 deletions

View File

@ -88,7 +88,7 @@ $head = oauthadmin_prepare_head();
dol_fiche_head($head, 'services', '', -1, 'technic');
print $langs->trans("ListOfSupportedOauthProviders").'<br><br>';
print '<span class="opacitymedium">'.$langs->trans("ListOfSupportedOauthProviders").'</span><br><br>';
print '<table class="noborder centpercent">';

View File

@ -122,7 +122,7 @@ dol_fiche_head($head, 'tokengeneration', '', -1, 'technic');
if ($mode == 'setup' && $user->admin)
{
print $langs->trans("OAuthSetupForLogin")."<br><br>\n";
print '<span class="opacitymedium">'.$langs->trans("OAuthSetupForLogin")."</span><br><br>\n";
foreach ($list as $key)
{
@ -135,14 +135,17 @@ if ($mode == 'setup' && $user->admin)
if ($key[0] == 'OAUTH_GITHUB_NAME')
{
$OAUTH_SERVICENAME = 'GitHub';
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?state=user,public_repo&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$state='user,public_repo'; // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service)
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?state='.$state.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms = 'https://github.com/settings/applications/';
}
elseif ($key[0] == 'OAUTH_GOOGLE_NAME')
{
$OAUTH_SERVICENAME = 'Google';
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$state='userinfo_email,userinfo_profile,cloud_print'; // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service)
//$state.=',gmail_full';
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state='.$state.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms = 'https://security.google.com/settings/security/permissions';
}

View File

@ -80,11 +80,13 @@ if ($action != 'delete' && empty($requestedpermissionsarray))
//var_dump($requestedpermissionsarray);exit;
// Instantiate the Api service using the credentials, http client and storage mechanism for the token
// $requestedpermissionsarray contains list of scopes.
// Conversion into URL is done by Reflection on constant with name SCOPE_scope_in_uppercase
/** @var $apiService Service */
$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
// also note that a refresh token is sent only after a prompt
$apiService->setAccessType('offline');
$apiService->setApprouvalPrompt('force');
@ -147,7 +149,7 @@ else // If entry on page with no parameter, we arrive here
// Creation of record with state in this tables depend on the Provider used (see its constructor).
if (GETPOST('state'))
{
$url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state')));
$url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state')));
}
else
{