Changeset 936

Show
Ignore:
Timestamp:
05/19/08 16:38:28 (7 months ago)
Author:
laurentj
Message:

jAuth : renamed persistanceEnabled event parameter by persistence, and this parameter contains the timestamp of the persistence timeout

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix/auth/jAuth.class.php

    r935 r936  
    303303 
    304304            $_SESSION[$config['session_name']] = $user; 
    305             $persistenceEnabled = ($persistant && isset($config['persistant_enable']) && $config['persistant_enable'])
     305            $persistence = 0
    306306 
    307307            // Add a cookie for session persistance, if enabled 
    308             if($persistenceEnabled) { 
     308            if($persistant && isset($config['persistant_enable']) && $config['persistant_enable']) { 
    309309                if(!isset($config['persistant_crypt_key']) || !isset($config['persistant_cookie_name'])){ 
    310310                    throw new jException('jelix~auth.error.persistant.incorrectconfig','persistant_cookie_name, persistant_crypt_key'); 
     
    312312 
    313313                if(isset($config['persistant_duration'])) 
    314                     $cookieDuration=$config['persistant_duration']*86400; 
     314                    $persistence=$config['persistant_duration']*86400; 
    315315                else 
    316                     $cookieDuration=86400; // 24h 
    317                 $cookieDuration+=time(); 
     316                    $persistence=86400; // 24h 
     317                $persistence += time(); 
    318318                $encryptedPassword=jCrypt::encrypt($password,$config['persistant_crypt_key']); 
    319                 setcookie($config['persistant_cookie_name'].'[login]', $login, $cookieDuration, $config['persistant_cookie_path']); 
    320                 setcookie($config['persistant_cookie_name'].'[passwd]', $encryptedPassword, $cookieDuration, $config['persistant_cookie_path']); 
    321             } 
    322  
    323             jEvent::notify ('AuthLogin', array('login'=>$login, 'persistenceEnabled'=>$persistenceEnabled)); 
     319                setcookie($config['persistant_cookie_name'].'[login]', $login, $persistence, $config['persistant_cookie_path']); 
     320                setcookie($config['persistant_cookie_name'].'[passwd]', $encryptedPassword, $persistence, $config['persistant_cookie_path']); 
     321            } 
     322 
     323            jEvent::notify ('AuthLogin', array('login'=>$login, 'persistence'=>$persistence)); 
    324324            return true; 
    325325        }else 
  • trunk/lib/jelix/auth/jAuth.class.php

    r935 r936  
    303303 
    304304            $_SESSION[$config['session_name']] = $user; 
    305             $persistenceEnabled = ($persistant && isset($config['persistant_enable']) && $config['persistant_enable'])
     305            $persistence = 0
    306306 
    307307            // Add a cookie for session persistance, if enabled 
    308             if($persistenceEnabled) { 
     308            if($persistant && isset($config['persistant_enable']) && $config['persistant_enable']) { 
    309309                if(!isset($config['persistant_crypt_key']) || !isset($config['persistant_cookie_name'])){ 
    310310                    throw new jException('jelix~auth.error.persistant.incorrectconfig','persistant_cookie_name, persistant_crypt_key'); 
     
    312312 
    313313                if(isset($config['persistant_duration'])) 
    314                     $cookieDuration=$config['persistant_duration']*86400; 
     314                    $persistence=$config['persistant_duration']*86400; 
    315315                else 
    316                     $cookieDuration=86400; // 24h 
    317                 $cookieDuration+=time(); 
     316                    $persistence=86400; // 24h 
     317                $persistence += time(); 
    318318                $encryptedPassword=jCrypt::encrypt($password,$config['persistant_crypt_key']); 
    319                 setcookie($config['persistant_cookie_name'].'[login]', $login, $cookieDuration, $config['persistant_cookie_path']); 
    320                 setcookie($config['persistant_cookie_name'].'[passwd]', $encryptedPassword, $cookieDuration, $config['persistant_cookie_path']); 
    321             } 
    322  
    323             jEvent::notify ('AuthLogin', array('login'=>$login, 'persistenceEnabled'=>$persistenceEnabled)); 
     319                setcookie($config['persistant_cookie_name'].'[login]', $login, $persistence, $config['persistant_cookie_path']); 
     320                setcookie($config['persistant_cookie_name'].'[passwd]', $encryptedPassword, $persistence, $config['persistant_cookie_path']); 
     321            } 
     322 
     323            jEvent::notify ('AuthLogin', array('login'=>$login, 'persistence'=>$persistence)); 
    324324            return true; 
    325325        }else 
  • trunk/lib/jelix/auth/jAuth.class.php

    r935 r936  
    303303 
    304304            $_SESSION[$config['session_name']] = $user; 
    305             $persistenceEnabled = ($persistant && isset($config['persistant_enable']) && $config['persistant_enable'])
     305            $persistence = 0
    306306 
    307307            // Add a cookie for session persistance, if enabled 
    308             if($persistenceEnabled) { 
     308            if($persistant && isset($config['persistant_enable']) && $config['persistant_enable']) { 
    309309                if(!isset($config['persistant_crypt_key']) || !isset($config['persistant_cookie_name'])){ 
    310310                    throw new jException('jelix~auth.error.persistant.incorrectconfig','persistant_cookie_name, persistant_crypt_key'); 
     
    312312 
    313313                if(isset($config['persistant_duration'])) 
    314                     $cookieDuration=$config['persistant_duration']*86400; 
     314                    $persistence=$config['persistant_duration']*86400; 
    315315                else 
    316                     $cookieDuration=86400; // 24h 
    317                 $cookieDuration+=time(); 
     316                    $persistence=86400; // 24h 
     317                $persistence += time(); 
    318318                $encryptedPassword=jCrypt::encrypt($password,$config['persistant_crypt_key']); 
    319                 setcookie($config['persistant_cookie_name'].'[login]', $login, $cookieDuration, $config['persistant_cookie_path']); 
    320                 setcookie($config['persistant_cookie_name'].'[passwd]', $encryptedPassword, $cookieDuration, $config['persistant_cookie_path']); 
    321             } 
    322  
    323             jEvent::notify ('AuthLogin', array('login'=>$login, 'persistenceEnabled'=>$persistenceEnabled)); 
     319                setcookie($config['persistant_cookie_name'].'[login]', $login, $persistence, $config['persistant_cookie_path']); 
     320                setcookie($config['persistant_cookie_name'].'[passwd]', $encryptedPassword, $persistence, $config['persistant_cookie_path']); 
     321            } 
     322 
     323            jEvent::notify ('AuthLogin', array('login'=>$login, 'persistence'=>$persistence)); 
    324324            return true; 
    325325        }else 
  • trunk/lib/jelix/auth/jAuth.class.php

    r935 r936  
    303303 
    304304            $_SESSION[$config['session_name']] = $user; 
    305             $persistenceEnabled = ($persistant && isset($config['persistant_enable']) && $config['persistant_enable'])
     305            $persistence = 0
    306306 
    307307            // Add a cookie for session persistance, if enabled 
    308             if($persistenceEnabled) { 
     308            if($persistant && isset($config['persistant_enable']) && $config['persistant_enable']) { 
    309309                if(!isset($config['persistant_crypt_key']) || !isset($config['persistant_cookie_name'])){ 
    310310                    throw new jException('jelix~auth.error.persistant.incorrectconfig','persistant_cookie_name, persistant_crypt_key'); 
     
    312312 
    313313                if(isset($config['persistant_duration'])) 
    314                     $cookieDuration=$config['persistant_duration']*86400; 
     314                    $persistence=$config['persistant_duration']*86400; 
    315315                else 
    316                     $cookieDuration=86400; // 24h 
    317                 $cookieDuration+=time(); 
     316                    $persistence=86400; // 24h 
     317                $persistence += time(); 
    318318                $encryptedPassword=jCrypt::encrypt($password,$config['persistant_crypt_key']); 
    319                 setcookie($config['persistant_cookie_name'].'[login]', $login, $cookieDuration, $config['persistant_cookie_path']); 
    320                 setcookie($config['persistant_cookie_name'].'[passwd]', $encryptedPassword, $cookieDuration, $config['persistant_cookie_path']); 
    321             } 
    322  
    323             jEvent::notify ('AuthLogin', array('login'=>$login, 'persistenceEnabled'=>$persistenceEnabled)); 
     319                setcookie($config['persistant_cookie_name'].'[login]', $login, $persistence, $config['persistant_cookie_path']); 
     320                setcookie($config['persistant_cookie_name'].'[passwd]', $encryptedPassword, $persistence, $config['persistant_cookie_path']); 
     321            } 
     322 
     323            jEvent::notify ('AuthLogin', array('login'=>$login, 'persistence'=>$persistence)); 
    324324            return true; 
    325325        }else 
Download in other formats: Unified Diff Zip Archive