[feature/oauth] ACP options for OAuth, needs some work

PHPBB3-11673
This commit is contained in:
Joseph Warner 2013-07-23 14:06:01 -04:00
parent 5578b7a578
commit 93cbdc37b5
4 changed files with 55 additions and 1 deletions

View file

@ -0,0 +1,15 @@
<h2>{L_AUTH_PROVIDER_OAUTH_TITLE}</h2>
<!-- BEGIN oauth_services -->
<fieldset>
<legend>{oauth_services.ACTUAL_NAME}</legend>
<dl>
<dt><label for="oauth_service_{oauth_services.NAME}_key">{L_AUTH_PROVIDER_OAUTH_KEY}{L_COLON}</label><br /><span>{L_AUTH_PROVIDER_OAUTH_KEY_EXPLAIN}</span></dt>
<dd><input type="text" id="oauth_service_{oauth_services.NAME}_key" size="40" name="config[auth_oauth_{oauth_services.NAME}_key]" value="{AUTH_LDAP_SERVER}" /></dd>
</dl>
<dl>
<dt><label for="oauth_service_{oauth_services.NAME}_secret">{L_AUTH_PROVIDER_OAUTH_SECRET}{L_COLON}</label><br /><span>{L_AUTH_PROVIDER_OAUTH_SECRET_EXPLAIN}</span></dt>
<dd><input type="text" id="oauth_service_{oauth_services.NAME}_secret" size="40" name="config[auth_oauth_{oauth_services.NAME}_secret]" value="{AUTH_LDAP_SERVER}" /></dd>
</dl>
</fieldset>
<!-- END oauth_services -->

View file

@ -658,7 +658,15 @@ class acp_board
$auth_tpl = $provider->get_acp_template($this->new_config);
if ($auth_tpl)
{
$template->assign_vars($auth_tpl['TEMPLATE_VARS']);
if (array_key_exists('BLOCK_VAR_NAME', $auth_tpl))
{
foreach ($auth_tpl['TEMPLATE_VARS'] as $block_vars)
{
$template->assign_block_vars($auth_tpl['BLOCK_VAR_NAME'], $block_vars);
}
} else {
$template->assign_vars($auth_tpl['TEMPLATE_VARS']);
}
$template->assign_block_vars('auth_tpl', array(
'TEMPLATE_FILE' => $auth_tpl['TEMPLATE_FILE'],
));

View file

@ -394,6 +394,15 @@ $lang = array_merge($lang, array(
'AUTH_METHOD' => 'Select an authentication method',
'AUTH_PROVIDER_OAUTH_KEY' => 'Key',
'AUTH_PROVIDER_OAUTH_KEY_EXPLAIN' => '',
'AUTH_PROVIDER_OAUTH_SERVICE_BITLY' => 'Bitly',
'AUTH_PROVIDER_OAUTH_SERVICE_FACEBOOK' => 'Facebook',
'AUTH_PROVIDER_OAUTH_SERVICE_GOOGLE' => 'Google',
'AUTH_PROVIDER_OAUTH_TITLE' => 'OAuth',
'AUTH_PROVIDER_OAUTH_SECRET' => 'Secret',
'AUTH_PROVIDER_OAUTH_SECRET_EXPLAIN' => '',
'APACHE_SETUP_BEFORE_USE' => 'You have to setup apache authentication before you switch phpBB to this authentication method. Keep in mind that the username you use for apache authentication has to be the same as your phpBB username. Apache authentication can only be used with mod_php (not with a CGI version) and safe_mode disabled.',
'LDAP_DN' => 'LDAP base <var>dn</var>',

View file

@ -256,4 +256,26 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
return $login_data;
}
/**
* {@inheritdoc}
*/
public function get_acp_template($new_config)
{
$ret = array(
'BLOCK_VAR_NAME' => 'oauth_services',
'TEMPLATE_FILE' => 'auth_provider_oauth.html',
'TEMPLATE_VARS' => array(),
);
foreach ($this->service_providers as $service_name => $service_provider)
{
$actual_name = str_replace('auth.provider.oauth.service.', '', $service_name);
$ret['TEMPLATE_VARS'][$actual_name] = array();
$ret['TEMPLATE_VARS'][$actual_name]['NAME'] = $actual_name;
$ret['TEMPLATE_VARS'][$actual_name]['ACTUAL_NAME'] = 'L_AUTH_PROVIDER_OAUTH_SERVICE_' . strtoupper($actual_name);
}
return $ret;
}
}