summaryrefslogtreecommitdiffstats
path: root/app/class/user.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/class/user.class.php')
-rw-r--r--app/class/user.class.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/class/user.class.php b/app/class/user.class.php
index 6bce26c..bd2e174 100644
--- a/app/class/user.class.php
+++ b/app/class/user.class.php
@@ -28,6 +28,21 @@ class User extends Object
}
/*
+ * Initialize object by username
+ */
+ function initByUsername($username)
+ {
+ $query = "SELECT guid FROM object WHERE type = 'user' AND name = '" . $this->db->esc($username) . "'";
+ $result = $this->db->query($query);
+
+ if (count($result) == 0)
+ return false;
+
+ $this->loadObj($result[0]['guid']);
+ return true;
+ }
+
+ /*
* Get all users -- ordered by name, ascending
*/
function getAllUsers_orderByName()
@@ -96,6 +111,15 @@ class User extends Object
return true;
}
+
+ /*
+ * Validate the password for this user. Returns true if correct, false otherwise
+ */
+ function validatePassword($password)
+ {
+ $key = $this->getKey($password, $this->salt);
+ return $key == $this->key;
+ }
}
?>