aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/auth
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/auth')
-rw-r--r--phpBB/phpbb/auth/auth.php6
-rw-r--r--phpBB/phpbb/auth/provider/apache.php4
-rw-r--r--phpBB/phpbb/auth/provider/db.php8
-rw-r--r--phpBB/phpbb/auth/provider/ldap.php2
-rw-r--r--phpBB/phpbb/auth/provider_collection.php8
5 files changed, 15 insertions, 13 deletions
diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php
index 38755ccf99..b59f0e60ec 100644
--- a/phpBB/phpbb/auth/auth.php
+++ b/phpBB/phpbb/auth/auth.php
@@ -927,11 +927,11 @@ class auth
*/
function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0)
{
- global $config, $db, $user, $phpbb_root_path, $phpEx, $phpbb_container;
+ global $db, $user, $phpbb_root_path, $phpEx, $phpbb_container;
- $method = trim(basename($config['auth_method']));
+ $provider_collection = $phpbb_container->get('auth.provider_collection');
- $provider = $phpbb_container->get('auth.provider.' . $method);
+ $provider = $provider_collection->get_provider();
if ($provider)
{
$login = $provider->login($username, $password);
diff --git a/phpBB/phpbb/auth/provider/apache.php b/phpBB/phpbb/auth/provider/apache.php
index 9137a77210..aa5bf64335 100644
--- a/phpBB/phpbb/auth/provider/apache.php
+++ b/phpBB/phpbb/auth/provider/apache.php
@@ -137,7 +137,7 @@ class apache extends \phpbb\auth\provider\base
return array(
'status' => LOGIN_SUCCESS_CREATE_PROFILE,
'error_msg' => false,
- 'user_row' => user_row_apache($php_auth_user, $php_auth_pw),
+ 'user_row' => $this->user_row($php_auth_user, $php_auth_pw),
);
}
@@ -185,7 +185,7 @@ class apache extends \phpbb\auth\provider\base
}
// create the user if he does not exist yet
- user_add(user_row_apache($php_auth_user, $php_auth_pw));
+ user_add($this->user_row($php_auth_user, $php_auth_pw));
$sql = 'SELECT *
FROM ' . USERS_TABLE . "
diff --git a/phpBB/phpbb/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php
index 722eeffa9a..d8c5fb72de 100644
--- a/phpBB/phpbb/auth/provider/db.php
+++ b/phpBB/phpbb/auth/provider/db.php
@@ -87,7 +87,7 @@ class db extends \phpbb\auth\provider\base
$username_clean = utf8_clean_string($username);
- $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type, user_login_attempts
+ $sql = 'SELECT *
FROM ' . USERS_TABLE . "
WHERE username_clean = '" . $this->db->sql_escape($username_clean) . "'";
$result = $this->db->sql_query($sql);
@@ -123,7 +123,7 @@ class db extends \phpbb\auth\provider\base
'username_clean' => $username_clean,
);
$sql = 'INSERT INTO ' . LOGIN_ATTEMPT_TABLE . $this->db->sql_build_array('INSERT', $attempt_data);
- $result = $this->db->sql_query($sql);
+ $this->db->sql_query($sql);
}
else
{
@@ -175,7 +175,7 @@ class db extends \phpbb\auth\provider\base
}
// Check password ...
- if ($this->passwords_manager->check($password, $row['user_password']))
+ if ($this->passwords_manager->check($password, $row['user_password'], $row))
{
// Check for old password hash...
if ($this->passwords_manager->convert_flag || strlen($row['user_password']) == 32)
@@ -232,7 +232,7 @@ class db extends \phpbb\auth\provider\base
// Give status about wrong password...
return array(
'status' => ($show_captcha) ? LOGIN_ERROR_ATTEMPTS : LOGIN_ERROR_PASSWORD,
- 'error_msg' => ($show_captcha) ? 'LOGIN_ERROR_ATTEMPTS' : 'LOGIN_ERROR_PASSWORD',
+ 'error_msg' => 'LOGIN_ERROR_PASSWORD',
'user_row' => $row,
);
}
diff --git a/phpBB/phpbb/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php
index d32e7504eb..c71950c698 100644
--- a/phpBB/phpbb/auth/provider/ldap.php
+++ b/phpBB/phpbb/auth/provider/ldap.php
@@ -306,7 +306,7 @@ class ldap extends \phpbb\auth\provider\base
return array(
'TEMPLATE_FILE' => 'auth_provider_ldap.html',
'TEMPLATE_VARS' => array(
- 'AUTH_LDAP_DN' => $new_config['ldap_base_dn'],
+ 'AUTH_LDAP_BASE_DN' => $new_config['ldap_base_dn'],
'AUTH_LDAP_EMAIL' => $new_config['ldap_email'],
'AUTH_LDAP_PASSORD' => $new_config['ldap_password'],
'AUTH_LDAP_PORT' => $new_config['ldap_port'],
diff --git a/phpBB/phpbb/auth/provider_collection.php b/phpBB/phpbb/auth/provider_collection.php
index a74a2135dc..8e7e9e2cc1 100644
--- a/phpBB/phpbb/auth/provider_collection.php
+++ b/phpBB/phpbb/auth/provider_collection.php
@@ -38,6 +38,7 @@ class provider_collection extends \phpbb\di\service_collection
/**
* Get an auth provider.
*
+ * @param string $provider_name The name of the auth provider
* @return object Default auth provider selected in config if it
* does exist. Otherwise the standard db auth
* provider.
@@ -46,11 +47,12 @@ class provider_collection extends \phpbb\di\service_collection
* auth provider exist. The db auth provider
* should always exist in a phpBB installation.
*/
- public function get_provider()
+ public function get_provider($provider_name = '')
{
- if ($this->offsetExists('auth.provider.' . basename(trim($this->config['auth_method']))))
+ $provider_name = ($provider_name !== '') ? $provider_name : basename(trim($this->config['auth_method']));
+ if ($this->offsetExists('auth.provider.' . $provider_name))
{
- return $this->offsetGet('auth.provider.' . basename(trim($this->config['auth_method'])));
+ return $this->offsetGet('auth.provider.' . $provider_name);
}
// Revert to db auth provider if selected method does not exist
else if ($this->offsetExists('auth.provider.db'))