From ed1d4fe4a03c55bbc997f11afa11a87b4fe78c4d Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 1 May 2014 14:23:39 +0200 Subject: [ticket/12352] Revert to db auth provider if default does not exist This will make sure that we will not encounter a non-existing auth provider. We will revert to the default db auth provider if the one set in the config does not exist in our auth provider collection. PHPBB3-12352 --- phpBB/includes/functions.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c423e29d9d..31a6246d34 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2854,7 +2854,16 @@ 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']); + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $auth_method = $config['auth_method']; + + // Revert to db auth provider if selected method does not exist + if (!isset($provider_collection['auth.provider.' . $config['auth_method']])) + { + $auth_method = 'db'; + } + + $auth_provider = $provider_collection['auth.provider.' . $auth_method]; $auth_provider_data = $auth_provider->get_login_data(); if ($auth_provider_data) -- cgit v1.2.1 From 6f5f0d6d8d5d3afcabccaa9da7c64108af5d4ab7 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 31 May 2014 22:43:07 +0200 Subject: [ticket/12352] Use custom provider collection for auth providers Using this custom provider collection, we can properly check whether the configured auth provider does exist. The method get_provider() has been added for returning the default auth provider or the standard db auth provider if the specified one does not exist. Additionally, the method get_provider() will throw an RuntimeException if none of the above exist. PHPBB3-12352 --- phpBB/includes/functions.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'phpBB/includes/functions.php') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 31a6246d34..0d0bc4e6f6 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2855,15 +2855,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa } $provider_collection = $phpbb_container->get('auth.provider_collection'); - $auth_method = $config['auth_method']; - - // Revert to db auth provider if selected method does not exist - if (!isset($provider_collection['auth.provider.' . $config['auth_method']])) - { - $auth_method = 'db'; - } - - $auth_provider = $provider_collection['auth.provider.' . $auth_method]; + $auth_provider = $provider_collection->get_provider(); $auth_provider_data = $auth_provider->get_login_data(); if ($auth_provider_data) -- cgit v1.2.1