Exemple #1
0
 /**
  * Send the username and password to the configured DB for authentication
  * @param string $user username
  * @param string $pass password
  * @return bool true if authentication worked
  */
 public function check_credentials($user, $pass)
 {
     if ($this->connect()) {
         $sql = $this->dbh->prepare("select hash from hm_user where username = ?");
         if ($sql->execute(array($user))) {
             $row = $sql->fetch();
             if ($row['hash'] && Hm_Crypt::check_password($pass, $row['hash'])) {
                 return true;
             }
         }
     }
     sleep(2);
     return false;
 }
Exemple #2
0
 /**
  * @preserveGlobalState disabled
  * @runInSeparateProcess
  */
 public function test_hash_password()
 {
     $hash = Hm_Crypt::hash_password('test');
     $this->assertTrue(Hm_Crypt::check_password('test', $hash));
 }