From 7bdab205a13380242ef2469d192abc22b48010d8 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Tue, 18 Jun 2013 16:55:35 -0400 Subject: [feature/auth-refactor] Refactor login to use new interface Refactors auth.php to use the provider_interface during login. PHPBB-9734 --- phpBB/includes/auth/auth.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/auth/auth.php') diff --git a/phpBB/includes/auth/auth.php b/phpBB/includes/auth/auth.php index 2535247571..009e621e13 100644 --- a/phpBB/includes/auth/auth.php +++ b/phpBB/includes/auth/auth.php @@ -932,10 +932,11 @@ class phpbb_auth $method = trim(basename($config['auth_method'])); include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); - $method = 'login_' . $method; - if (function_exists($method)) + $class = 'phpbb_auth_provider_' . $method; + if (class_exists($class)) { - $login = $method($username, $password, $user->ip, $user->browser, $user->forwarded_for); + $provider = new $class(); + $login = $provider->login($username, $password); // If the auth module wants us to create an empty profile do so and then treat the status as LOGIN_SUCCESS if ($login['status'] == LOGIN_SUCCESS_CREATE_PROFILE) -- cgit v1.2.1 From 553c300688818c36acc4d579762b3eb428d27321 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Wed, 19 Jun 2013 14:20:29 -0400 Subject: [feature/auth-refactor] Fix typos causing changes to not work Replaces short tags with long tags. Fixes the interface to be an interface and not class in the file. Removes unnecessary include_once from auth.php. PHPBB-9734 --- phpBB/includes/auth/auth.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/includes/auth/auth.php') diff --git a/phpBB/includes/auth/auth.php b/phpBB/includes/auth/auth.php index 009e621e13..ab84619977 100644 --- a/phpBB/includes/auth/auth.php +++ b/phpBB/includes/auth/auth.php @@ -930,7 +930,6 @@ class phpbb_auth global $config, $db, $user, $phpbb_root_path, $phpEx; $method = trim(basename($config['auth_method'])); - include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); $class = 'phpbb_auth_provider_' . $method; if (class_exists($class)) -- cgit v1.2.1 From b8610c4b989fd1e4e9e310de776de38dfe4a09a2 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Fri, 21 Jun 2013 18:04:11 -0400 Subject: [feature/auth-refactor] Refactor code to use services Refactors all loading of auth providers to use services instead of directly calling the class. PHPBB3-9734 --- phpBB/includes/auth/auth.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/auth/auth.php') diff --git a/phpBB/includes/auth/auth.php b/phpBB/includes/auth/auth.php index ab84619977..279959974d 100644 --- a/phpBB/includes/auth/auth.php +++ b/phpBB/includes/auth/auth.php @@ -927,14 +927,13 @@ class phpbb_auth */ function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0) { - global $config, $db, $user, $phpbb_root_path, $phpEx; + global $config, $db, $user, $phpbb_root_path, $phpEx, $phpbb_container; $method = trim(basename($config['auth_method'])); - $class = 'phpbb_auth_provider_' . $method; - if (class_exists($class)) + $provider = $phpbb_container->get('auth.provider.' . $method); + if ($provider) { - $provider = new $class(); $login = $provider->login($username, $password); // If the auth module wants us to create an empty profile do so and then treat the status as LOGIN_SUCCESS -- cgit v1.2.1