public function verify($redirect = FALSE)
 {
     Oraculum_Request::init_sess();
     $user = Oraculum_Request::sess($this->_sessname);
     if (!is_null($user)) {
         $ip = Oraculum_Crypt::strdcrypt($user['ip']);
         if ($ip != Oraculum_HTTP::ip()) {
             if ($redirect) {
                 Oraculum_HTTP::redirect($this->_logoffurl);
             }
             return false;
         } else {
             return true;
         }
     } else {
         if ($redirect) {
             Oraculum_HTTP::redirect($this->_logoffurl);
         }
         return false;
     }
 }
Exemple #2
0
function strdcrypt($str)
{
    return Oraculum_Crypt::strdcrypt($str);
}
Exemple #3
0
 public function PasswordlessAuth($clearkey = TRUE)
 {
     if (is_object($this->_dbobj)) {
         $cryptfield = $this->_cryptkeyfield;
         $getcryptfield = 'getBy' . ucwords($this->_cryptkeyfield);
         $keyfield = $this->_keyfield;
         $obj = $this->_dbobj;
         $this->_register = $obj->{$getcryptfield}($this->_cryptkey);
         if (sizeof($this->_register) == 1) {
             $this->_key = $this->_register->{$keyfield};
             $key = Oraculum_Crypt::strdcrypt($this->_cryptkey);
             $key = explode('::', $key);
             $time = $key[0];
             $timeout = $key[2];
             $auth = time() < $time + $timeout;
             if ($auth && $clearkey) {
                 $this->_register->{$cryptfield} = NULL;
                 $this->_register->save();
             }
             return $auth;
         } else {
             return FALSE;
         }
     } else {
         throw new Exception('Para autenticacao atraves de base de dados deve ser passada uma instancia relacionada a uma entidade do banco');
     }
 }