Exemple #1
0
 public function reg()
 {
     if ($this->validate()) {
         $user = new User();
         $user->username = $this->username;
         $password = User::createPassword($this->password);
         $user->password = $password['password'];
         $user->salt = $password['salt'];
         return $user->insert();
     }
     return false;
 }
Exemple #2
0
 public function validatePassword($password)
 {
     return User::createPassword($password, $this->salt)['password'] == $this->password;
 }