diff options
author | Joseph Warner <hardolaf@hardolaf.com> | 2013-08-02 14:05:09 -0400 |
---|---|---|
committer | Joseph Warner <hardolaf@hardolaf.com> | 2013-08-02 14:05:44 -0400 |
commit | 245e71e4e20b8d4ec80fc5e059dc12db51d10651 (patch) | |
tree | e77402c16215a38b0a631b2aedde4463d73e6df1 /phpBB | |
parent | 381e7c347b0d7cfc0f02d677aa61b92701606504 (diff) | |
download | forums-245e71e4e20b8d4ec80fc5e059dc12db51d10651.tar forums-245e71e4e20b8d4ec80fc5e059dc12db51d10651.tar.gz forums-245e71e4e20b8d4ec80fc5e059dc12db51d10651.tar.bz2 forums-245e71e4e20b8d4ec80fc5e059dc12db51d10651.tar.xz forums-245e71e4e20b8d4ec80fc5e059dc12db51d10651.zip |
[feature/oauth] Add get_login_data to the auth_provider_interface
PHPBB3-11673
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/functions.php | 20 | ||||
-rw-r--r-- | phpBB/phpbb/auth/provider/base.php | 8 | ||||
-rw-r--r-- | phpBB/phpbb/auth/provider/interface.php | 21 | ||||
-rw-r--r-- | phpBB/phpbb/auth/provider/oauth/oauth.php | 4 |
4 files changed, 50 insertions, 3 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 02cdfd7ed1..79391aba56 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3367,6 +3367,26 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa $s_hidden_fields['credential'] = $credential; } + $auth_provider = $phpbb_container->get('auth.provider.' . $config['auth_method']); + + $auth_provider_data = $auth_provider->get_login_data(); + if ($auth_provider_data) + { + if (isset($auth_provider_data['VARS'])) + { + $template->assign_vars($auth_provider_data['VARS']); + } + + if (isset($auth_provider_data['BLOCK_VAR_NAME'])) + { + $template->assign_block_vars($auth_provider_data['BLOCK_VAR_NAME'], $auth_provider_data['BLOCK_VARS']); + } + + $template->assign_vars(array( + 'PROVIDER_TEMPLATE_FILE' => $auth_provider_data['TEMPLATE_FILE'], + )); + } + $oauth_login = ($config['auth_method'] == 'oauth') ? true : false; if ($oauth_login) diff --git a/phpBB/phpbb/auth/provider/base.php b/phpBB/phpbb/auth/provider/base.php index ca1c635b15..ae1daba82b 100644 --- a/phpBB/phpbb/auth/provider/base.php +++ b/phpBB/phpbb/auth/provider/base.php @@ -57,6 +57,14 @@ abstract class phpbb_auth_provider_base implements phpbb_auth_provider_interface /** * {@inheritdoc} */ + public function get_login_data() + { + return; + } + + /** + * {@inheritdoc} + */ public function logout($data, $new_session) { return; diff --git a/phpBB/phpbb/auth/provider/interface.php b/phpBB/phpbb/auth/provider/interface.php index fd3fa7d879..21526fd858 100644 --- a/phpBB/phpbb/auth/provider/interface.php +++ b/phpBB/phpbb/auth/provider/interface.php @@ -107,6 +107,27 @@ interface phpbb_auth_provider_interface public function get_acp_template($new_config); /** + * Returns an array of data necessary to build custom elements on the login + * form. + * + * @return array|null If this function is not implemented on an auth + * provider then it returns null. If it is implemented + * it will return an array of up to four elements of + * which only 'TEMPLATE_FILE'. If 'BLOCK_VAR_NAME' is + * present then 'BLOCK_VARS' must also be present in + * the array. The fourth element 'VARS' is also + * optional. The array, with all four elements present + * looks like the following: + * array( + * 'TEMPLATE_FILE' => string, + * 'BLOCK_VAR_NAME' => string, + * 'BLOCK_VARS' => array(...), + * 'VARS' => array(...), + * ) + */ + public function get_login_data(); + + /** * Performs additional actions during logout. * * @param array $data An array corresponding to diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index 8979f413b5..62024ff094 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -274,9 +274,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base } /** - * Returns an array of login data for all enabled OAuth services. - * - * @return array + * {@inheritdoc} */ public function get_login_data() { |