[feature/oauth] Initial step in creating OAuth login support

PHPBB3-11673
This commit is contained in:
Joseph Warner 2013-07-22 16:23:13 -04:00
parent d804842cef
commit cd49cfacfb
3 changed files with 26 additions and 2 deletions

View file

@ -3199,7 +3199,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = false, $s_display = true) function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = false, $s_display = true)
{ {
global $db, $user, $template, $auth, $phpEx, $phpbb_root_path, $config; global $db, $user, $template, $auth, $phpEx, $phpbb_root_path, $config;
global $request; global $request, $phpbb_container;
if (!class_exists('phpbb_captcha_factory', false)) if (!class_exists('phpbb_captcha_factory', false))
{ {
@ -3367,12 +3367,22 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
$s_hidden_fields['credential'] = $credential; $s_hidden_fields['credential'] = $credential;
} }
$oauth_login = ($config['auth_method'] == 'oauth') ? true : false;
if ($oauth_login)
{
$auth_provider = $phpbb_container->get('auth.provider.oauth');
$oauth_box_data = $auth_provider->get_login_data();
}
$s_hidden_fields = build_hidden_fields($s_hidden_fields); $s_hidden_fields = build_hidden_fields($s_hidden_fields);
$template->assign_vars(array( $template->assign_vars(array(
'LOGIN_ERROR' => $err, 'LOGIN_ERROR' => $err,
'LOGIN_EXPLAIN' => $l_explain, 'LOGIN_EXPLAIN' => $l_explain,
'OAUTH_LOGIN' => $oauth_login,
'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : '', 'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : '',
'U_RESEND_ACTIVATION' => ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=resend_act') : '', 'U_RESEND_ACTIVATION' => ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=resend_act') : '',
'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'), 'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'),

View file

@ -230,4 +230,14 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
$service_factory = new \OAuth\ServiceFactory(); $service_factory = new \OAuth\ServiceFactory();
return $service_factory->createService($service_name, $credentials, $storage, $scopes); return $service_factory->createService($service_name, $credentials, $storage, $scopes);
} }
/**
* Returns an array of login data for all enabled OAuth services.
*
* @return array
*/
public function get_login_data()
{
return array();
}
} }

View file

@ -46,7 +46,11 @@
<dd>{S_HIDDEN_FIELDS}<input type="submit" name="login" tabindex="6" value="{L_LOGIN}" class="button1" /></dd> <dd>{S_HIDDEN_FIELDS}<input type="submit" name="login" tabindex="6" value="{L_LOGIN}" class="button1" /></dd>
</dl> </dl>
</fieldset> </fieldset>
</div> </div><!-- IF OAUTH_LOGIN -->
<div class="content">
hi
</div><!-- ENDIF -->
</div> </div>
</div> </div>