Beispiel #1
0
 public static function getUser($username)
 {
     $db = new \Shop\Database();
     $obtainedUser = $db->fetchUser($username);
     if ($obtainedUser == false) {
         return false;
     }
     return $obtainedUser;
 }
Beispiel #2
0
 public function signup($username, $address, $password, $repassword)
 {
     $db = new \Shop\Database();
     if (!$this->checkUsername($username)) {
         return false;
     }
     if (!$db->usernameAvailable($username)) {
         $this->errorMessage = "Username not available!";
         return false;
     }
     $passwordOK = $this->checkPasswordSecurity($password, $repassword);
     if ($passwordOK) {
         $hash = password_hash($password, PASSWORD_DEFAULT);
         $_SESSION['user'] = [$username, $address];
         $db->addUser($username, $this->untagAddress($address), $hash);
         return true;
     }
     return false;
 }