Beispiel #1
0
 public function isPassHashKeyValid($hashKey)
 {
     // check if same as user's saved hash key
     if (base64_decode($hashKey) != base64_decode($this->getPasswordHashKey())) {
         throw new kAdminKuserException('', kAdminKuserException::NEW_PASSWORD_HASH_KEY_INVALID);
     }
     // decode
     $params = adminKuserPeer::decodePassHashKey($hashKey);
     if (!$params) {
         throw new kAdminKuserException('', kAdminKuserException::NEW_PASSWORD_HASH_KEY_INVALID);
     }
     // check if admin_kuser id is right
     if ($params[0] != $this->getId()) {
         throw new kAdminKuserException('', kAdminKuserException::NEW_PASSWORD_HASH_KEY_INVALID);
     }
     // check if not expired
     if ($params[1] < time()) {
         throw new kAdminKuserException('', kAdminKuserException::NEW_PASSWORD_HASH_KEY_EXPIRED);
     }
     return true;
 }