1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-06 15:45:34 +02:00

[feature/oauth] Basic login functionality now working

These changes are currently unique to OAuth and need to be made
generic so that any auth provider can modify the login template.

PHPBB3-11673
This commit is contained in:
Joseph Warner 2013-07-24 10:39:48 -04:00
parent ffb14a6988
commit 58d5820069
2 changed files with 8 additions and 10 deletions

View File

@ -3373,12 +3373,9 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
{ {
$auth_provider = $phpbb_container->get('auth.provider.oauth'); $auth_provider = $phpbb_container->get('auth.provider.oauth');
$oauth_box_data = $auth_provider->get_login_data(); $oauth_box_data = $auth_provider->get_login_data();
foreach ($oauth_box_data as $service_name => $data) foreach ($oauth_box_data as $data)
{ {
$template->assign_block_vars('oauth', array( $template->assign_block_vars('oauth', $data);
'SERVICE_NAME' => $service_name,
'REDIRECT_URL' => $data['url'],
));
} }
} }

View File

@ -272,11 +272,12 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
$credentials = $service_provider->get_service_credentials(); $credentials = $service_provider->get_service_credentials();
if ($credentials['key'] && $credentials['secret']) if ($credentials['key'] && $credentials['secret'])
{ {
$login_data[$service_provider] = array(); $actual_name = str_replace('auth.provider.oauth.service.', '', $service_name);
$redirect_url = build_url(false) . '&login=external&oauth_service=' . $actual_name;
// Build the redirect url for the box $login_data[$service_name] = array(
$redirect_url = build_url(false) . '&oauth_service=' . $service_name; 'REDIRECT_URL' => redirect($redirect_url, true),
$login_data[$service_provider]['url'] = redirect($redirect_url, true); 'SERVICE_NAME' => $this->user->lang['AUTH_PROVIDER_OAUTH_SERVICE_' . strtoupper($actual_name)],
);
} }
} }