Exemplo n.º 1
0
 /**
  * Password sent by user must be:
  * sha1(saved_hash + Y-m-d)
  * 
  * @param type $login
  * @param type $password
  * @return int
  */
 public function getUserId($login, $password)
 {
     $user = $this->findFirst("login = '******'");
     if ($user != false) {
         $keys = new Keys();
         $vKeys = [];
         foreach ($keys->getValidList() as $key) {
             $vKeys[] = sha1($user->password . $key['key']);
         }
         if (in_array($password, $vKeys)) {
             return $user->id;
         }
     }
     return null;
 }
 private function getKeys()
 {
     $keys = new Keys();
     return $keys->getValidList();
 }