Fix bug for password change
This commit is contained in:
@@ -70,6 +70,27 @@ class Authentication extends Base
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate a user by different methods
|
||||
*
|
||||
* @access public
|
||||
* @param string $username Username
|
||||
* @param string $password Password
|
||||
* @return boolean
|
||||
*/
|
||||
public function authenticate($username, $password)
|
||||
{
|
||||
// Try first the database auth and then LDAP if activated
|
||||
if ($this->backend('database')->authenticate($username, $password)) {
|
||||
return true;
|
||||
}
|
||||
else if (LDAP_AUTH && $this->backend('ldap')->authenticate($username, $password)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate user login form
|
||||
*
|
||||
@@ -90,17 +111,7 @@ class Authentication extends Base
|
||||
|
||||
if ($result) {
|
||||
|
||||
$authenticated = false;
|
||||
|
||||
// Try first the database auth and then LDAP if activated
|
||||
if ($this->backend('database')->authenticate($values['username'], $values['password'])) {
|
||||
$authenticated = true;
|
||||
}
|
||||
else if (LDAP_AUTH && $this->backend('ldap')->authenticate($values['username'], $values['password'])) {
|
||||
$authenticated = true;
|
||||
}
|
||||
|
||||
if ($authenticated) {
|
||||
if ($this->authenticate($values['username'], $values['password'])) {
|
||||
|
||||
// Setup the remember me feature
|
||||
if (! empty($values['remember_me'])) {
|
||||
|
||||
@@ -307,9 +307,7 @@ class User extends Base
|
||||
if ($v->execute()) {
|
||||
|
||||
// Check password
|
||||
list($authenticated,) = $this->authenticate($_SESSION['user']['username'], $values['current_password']);
|
||||
|
||||
if ($authenticated) {
|
||||
if ($this->authentication->authenticate($_SESSION['user']['username'], $values['current_password'])) {
|
||||
return array(true, array());
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user