diff options
Diffstat (limited to 'lib/model/User.php')
-rw-r--r-- | lib/model/User.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/model/User.php b/lib/model/User.php new file mode 100644 index 0000000..693aeb7 --- /dev/null +++ b/lib/model/User.php @@ -0,0 +1,36 @@ +<?php + +/** + * Subclass for representing a row from the 'user' table. + * + * + * + * @package lib.model + */ +class User extends BaseUser +{ + public function setPassword($password) + { + if($password=='') + return false; + $salt = md5(rand(100000, 999999).$this->getNickname().$this->getFirstName()); + $this->setSalt($salt); + $this->setSha1Password(sha1($salt.$password)); + } + + public function setPassword2($password) + { + if($password!='') + $this->setPassword($password); + } + + public function getFullName() + { + return $this->getFirstName()." ".$this->getLastName(); + } + + public function __toString() + { + return $this->getNickname(); + } +} |