summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-08-19 18:29:13 -0700
committerFrédéric Guillot <fred@kanboard.net>2014-08-19 18:29:13 -0700
commit11b4715d2953dbd90a13fc8d20d9757701397e8c (patch)
tree73340d57859b18f932fe3f66c4d91e2b5ae446cd /app
parentf8071e7d4adf9d5fb1f255056aef98d5c3600c17 (diff)
Fix bug for password change
Diffstat (limited to 'app')
-rw-r--r--app/Controller/Base.php1
-rw-r--r--app/Model/Authentication.php33
-rw-r--r--app/Model/User.php4
3 files changed, 24 insertions, 14 deletions
diff --git a/app/Controller/Base.php b/app/Controller/Base.php
index ed8a6b3b..41585965 100644
--- a/app/Controller/Base.php
+++ b/app/Controller/Base.php
@@ -28,6 +28,7 @@ use Model\LastLogin;
* @property \Model\SubTask $subTask
* @property \Model\Task $task
* @property \Model\User $user
+ * @property \Model\Webhook $webhook
*/
abstract class Base
{
diff --git a/app/Model/Authentication.php b/app/Model/Authentication.php
index 4c8aad82..6efc5687 100644
--- a/app/Model/Authentication.php
+++ b/app/Model/Authentication.php
@@ -71,6 +71,27 @@ class Authentication extends Base
}
/**
+ * 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
*
* @access public
@@ -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'])) {
diff --git a/app/Model/User.php b/app/Model/User.php
index cfabd342..d019dfcc 100644
--- a/app/Model/User.php
+++ b/app/Model/User.php
@@ -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 {