Look and feel v11
This commit is contained in:
parent
a3fa6eb473
commit
6e2e02fd40
@ -88,7 +88,7 @@ $head = oauthadmin_prepare_head();
|
|||||||
dol_fiche_head($head, 'services', '', -1, 'technic');
|
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">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
|
|||||||
@ -122,7 +122,7 @@ dol_fiche_head($head, 'tokengeneration', '', -1, 'technic');
|
|||||||
|
|
||||||
if ($mode == 'setup' && $user->admin)
|
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)
|
foreach ($list as $key)
|
||||||
{
|
{
|
||||||
@ -135,14 +135,17 @@ if ($mode == 'setup' && $user->admin)
|
|||||||
if ($key[0] == 'OAUTH_GITHUB_NAME')
|
if ($key[0] == 'OAUTH_GITHUB_NAME')
|
||||||
{
|
{
|
||||||
$OAUTH_SERVICENAME = 'GitHub';
|
$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');
|
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||||
$urltocheckperms = 'https://github.com/settings/applications/';
|
$urltocheckperms = 'https://github.com/settings/applications/';
|
||||||
}
|
}
|
||||||
elseif ($key[0] == 'OAUTH_GOOGLE_NAME')
|
elseif ($key[0] == 'OAUTH_GOOGLE_NAME')
|
||||||
{
|
{
|
||||||
$OAUTH_SERVICENAME = 'Google';
|
$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');
|
$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';
|
$urltocheckperms = 'https://security.google.com/settings/security/permissions';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,11 +80,13 @@ if ($action != 'delete' && empty($requestedpermissionsarray))
|
|||||||
//var_dump($requestedpermissionsarray);exit;
|
//var_dump($requestedpermissionsarray);exit;
|
||||||
|
|
||||||
// Instantiate the Api service using the credentials, http client and storage mechanism for the token
|
// 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 */
|
/** @var $apiService Service */
|
||||||
$apiService = $serviceFactory->createService('Google', $credentials, $storage, $requestedpermissionsarray);
|
$apiService = $serviceFactory->createService('Google', $credentials, $storage, $requestedpermissionsarray);
|
||||||
|
|
||||||
// access type needed to have oauth provider refreshing token
|
// 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->setAccessType('offline');
|
||||||
|
|
||||||
$apiService->setApprouvalPrompt('force');
|
$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).
|
// Creation of record with state in this tables depend on the Provider used (see its constructor).
|
||||||
if (GETPOST('state'))
|
if (GETPOST('state'))
|
||||||
{
|
{
|
||||||
$url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state')));
|
$url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state')));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user