Fix bug for password change
This commit is contained in:
@@ -28,6 +28,7 @@ use Model\LastLogin;
|
|||||||
* @property \Model\SubTask $subTask
|
* @property \Model\SubTask $subTask
|
||||||
* @property \Model\Task $task
|
* @property \Model\Task $task
|
||||||
* @property \Model\User $user
|
* @property \Model\User $user
|
||||||
|
* @property \Model\Webhook $webhook
|
||||||
*/
|
*/
|
||||||
abstract class Base
|
abstract class Base
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -70,6 +70,27 @@ class Authentication extends Base
|
|||||||
return false;
|
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
|
* Validate user login form
|
||||||
*
|
*
|
||||||
@@ -90,17 +111,7 @@ class Authentication extends Base
|
|||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|
||||||
$authenticated = false;
|
if ($this->authenticate($values['username'], $values['password'])) {
|
||||||
|
|
||||||
// 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) {
|
|
||||||
|
|
||||||
// Setup the remember me feature
|
// Setup the remember me feature
|
||||||
if (! empty($values['remember_me'])) {
|
if (! empty($values['remember_me'])) {
|
||||||
|
|||||||
@@ -307,9 +307,7 @@ class User extends Base
|
|||||||
if ($v->execute()) {
|
if ($v->execute()) {
|
||||||
|
|
||||||
// Check password
|
// Check password
|
||||||
list($authenticated,) = $this->authenticate($_SESSION['user']['username'], $values['current_password']);
|
if ($this->authentication->authenticate($_SESSION['user']['username'], $values['current_password'])) {
|
||||||
|
|
||||||
if ($authenticated) {
|
|
||||||
return array(true, array());
|
return array(true, array());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user