diff options
Diffstat (limited to 'lib/user/database.php')
-rw-r--r-- | lib/user/database.php | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/user/database.php b/lib/user/database.php index 52f3b35fa5c..76b44a2f6ca 100644 --- a/lib/user/database.php +++ b/lib/user/database.php @@ -44,8 +44,8 @@ class OC_User_Database extends OC_User_Backend { */ static private $hasher=null; - private function getHasher(){ - if(!self::$hasher){ + private function getHasher() { + if(!self::$hasher) { //we don't want to use DES based crypt(), since it doesn't return a has with a recognisable prefix $forcePortable=(CRYPT_BLOWFISH!=1); self::$hasher=new PasswordHash(8,$forcePortable); @@ -63,8 +63,8 @@ class OC_User_Database extends OC_User_Backend { * Creates a new user. Basic checking of username is done in OC_User * itself, not in its subclasses. */ - public function createUser( $uid, $password ){ - if( $this->userExists($uid) ){ + public function createUser( $uid, $password ) { + if( $this->userExists($uid) ) { return false; }else{ $hasher=$this->getHasher(); @@ -83,7 +83,7 @@ class OC_User_Database extends OC_User_Backend { * * Deletes a user */ - public function deleteUser( $uid ){ + public function deleteUser( $uid ) { // Delete user-group-relation $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*users` WHERE uid = ?' ); $query->execute( array( $uid )); @@ -98,8 +98,8 @@ class OC_User_Database extends OC_User_Backend { * * Change the password of a user */ - public function setPassword( $uid, $password ){ - if( $this->userExists($uid) ){ + public function setPassword( $uid, $password ) { + if( $this->userExists($uid) ) { $hasher=$this->getHasher(); $hash = $hasher->HashPassword($password.OC_Config::getValue('passwordsalt', '')); $query = OC_DB::prepare( 'UPDATE `*PREFIX*users` SET `password` = ? WHERE `uid` = ?' ); @@ -120,22 +120,22 @@ class OC_User_Database extends OC_User_Backend { * Check if the password is correct without logging in the user * returns the user id or false */ - public function checkPassword( $uid, $password ){ + public function checkPassword( $uid, $password ) { $query = OC_DB::prepare( 'SELECT `uid`, `password` FROM `*PREFIX*users` WHERE LOWER(`uid`) = LOWER(?)' ); $result = $query->execute( array( $uid)); $row=$result->fetchRow(); - if($row){ + if($row) { $storedHash=$row['password']; - if ($storedHash[0]=='$'){//the new phpass based hashing + if ($storedHash[0]=='$') {//the new phpass based hashing $hasher=$this->getHasher(); - if($hasher->CheckPassword($password.OC_Config::getValue('passwordsalt', ''), $storedHash)){ + if($hasher->CheckPassword($password.OC_Config::getValue('passwordsalt', ''), $storedHash)) { return $row['uid']; }else{ return false; } }else{//old sha1 based hashing - if(sha1($password)==$storedHash){ + if(sha1($password)==$storedHash) { //upgrade to new hashing $this->setPassword($row['uid'],$password); return $row['uid']; @@ -169,7 +169,7 @@ class OC_User_Database extends OC_User_Backend { * @param string $uid the username * @return boolean */ - public function userExists($uid){ + public function userExists($uid) { $query = OC_DB::prepare( 'SELECT * FROM `*PREFIX*users` WHERE LOWER(`uid`) = LOWER(?)' ); $result = $query->execute( array( $uid )); @@ -181,8 +181,8 @@ class OC_User_Database extends OC_User_Backend { * @param string $uid the username * @return boolean */ - public function getHome($uid){ - if($this->userExists($uid)){ + public function getHome($uid) { + if($this->userExists($uid)) { return OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ) . '/' . $uid; }else{ return false; |