fix some docblocks in userservice
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@632 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
d385ce8641
commit
132fe726a8
1 changed files with 31 additions and 12 deletions
|
@ -645,8 +645,6 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete all bookmarks.
|
* Delete all bookmarks.
|
||||||
* Mainly used in unit tests.
|
* Mainly used in unit tests.
|
||||||
|
@ -659,22 +657,43 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
|
||||||
$this->db->sql_query($query);
|
$this->db->sql_query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hashes the password for storage in/querying the database.
|
||||||
function sanitisePassword($password) {
|
*
|
||||||
|
* @param string $password Password to hash
|
||||||
|
*
|
||||||
|
* @return string Hashed password
|
||||||
|
*/
|
||||||
|
public function sanitisePassword($password)
|
||||||
|
{
|
||||||
return sha1(trim($password));
|
return sha1(trim($password));
|
||||||
}
|
}
|
||||||
|
|
||||||
function generatePassword($uId) {
|
/**
|
||||||
if (!is_numeric($uId))
|
* Changes the password for the given user to a new, random one.
|
||||||
return false;
|
*
|
||||||
|
* @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();
|
$password = $this->_randompassword();
|
||||||
|
|
||||||
if ($this->_updateuser($uId, $this->getFieldName('password'), $this->sanitisePassword($password)))
|
$ok = $this->_updateuser(
|
||||||
return $password;
|
$uId, $this->getFieldName('password'),
|
||||||
else
|
$this->sanitisePassword($password)
|
||||||
return false;
|
);
|
||||||
|
|
||||||
|
if ($ok) {
|
||||||
|
return $password;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isReserved($username) {
|
function isReserved($username) {
|
||||||
|
|
Loading…
Reference in a new issue