summaryrefslogtreecommitdiff
path: root/src/SemanticScuttle/Service
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-02-05 18:46:16 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-02-05 18:46:16 +0000
commit132fe726a872a066a2fc90d05b4823e22587133f (patch)
treea831e1a81024e30901a4758f7284556d71960bc5 /src/SemanticScuttle/Service
parentd385ce8641035b92481ccfd1bc56fdf45bd3e1bc (diff)
downloadsemanticscuttle-132fe726a872a066a2fc90d05b4823e22587133f.tar.gz
semanticscuttle-132fe726a872a066a2fc90d05b4823e22587133f.tar.bz2
fix some docblocks in userservice
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@632 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'src/SemanticScuttle/Service')
-rw-r--r--src/SemanticScuttle/Service/User.php43
1 files changed, 31 insertions, 12 deletions
diff --git a/src/SemanticScuttle/Service/User.php b/src/SemanticScuttle/Service/User.php
index af732dd..cedde92 100644
--- a/src/SemanticScuttle/Service/User.php
+++ b/src/SemanticScuttle/Service/User.php
@@ -645,8 +645,6 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
return true;
}
-
-
/**
* Delete all bookmarks.
* Mainly used in unit tests.
@@ -659,22 +657,43 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
$this->db->sql_query($query);
}
-
-
- function sanitisePassword($password) {
+ /**
+ * Hashes the password for storage in/querying the database.
+ *
+ * @param string $password Password to hash
+ *
+ * @return string Hashed password
+ */
+ public function sanitisePassword($password)
+ {
return sha1(trim($password));
}
- function generatePassword($uId) {
- if (!is_numeric($uId))
- return false;
+ /**
+ * Changes the password for the given user to a new, random one.
+ *
+ * @param integer $uId User ID
+ *
+ * @return string New password of false if something went wrong
+ */
+ public function generatePassword($uId)
+ {
+ if (!is_numeric($uId)) {
+ return false;
+ }
$password = $this->_randompassword();
- if ($this->_updateuser($uId, $this->getFieldName('password'), $this->sanitisePassword($password)))
- return $password;
- else
- return false;
+ $ok = $this->_updateuser(
+ $uId, $this->getFieldName('password'),
+ $this->sanitisePassword($password)
+ );
+
+ if ($ok) {
+ return $password;
+ } else {
+ return false;
+ }
}
function isReserved($username) {