Changeset 136

Show
Ignore:
Timestamp:
06/27/07 13:46:19 (2 years ago)
Author:
shupp
Message:

move logout funtions to Login module, adding messaging. Add new inactivtyTimeout configuration option - 300 seconds by default

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Framework/Auth/Vpopmail.php

    r129 r136  
    77    public function authenticate() 
    88    { 
     9        // Check timeout 
     10        $time = time(); 
     11        $lastActionTime = $this->session->__get('lastActionTime'); 
     12        $timeLimit = (int)Framework::$site->config->inactiveTimeout; 
     13        if($this->user->debug == 1); 
     14            $this->log->log("timeout info: time: $time, lastActionTime: $lastActionTime, timeLimit: $timeLimit"); 
     15        if(($time - $lastActionTime) > $timeLimit) { 
     16            header('Location: ./?module=Login&event=logoutInactive'); 
     17            return false; 
     18        } 
     19 
     20        // Authenticate 
    921        $encryptedPass = $this->session->__get('password'); 
    1022        $plainPass =  Framework_User_passEncryption::decryptPass($encryptedPass, (string)Framework::$site->config->mcryptKey); 
    1123        if(!PEAR::isError($this->user->authenticate($this->session->__get('email'), $plainPass))) { 
     24            $this->session->__set('lastActionTime', $time); 
    1225            $this->setData('logged_in_as', $this->session->__get('email')); 
    1326            $this->setData('LANG_logged_in_as', _('logged in as')); 
  • trunk/Framework/Module/Login.php

    r129 r136  
    4141            if(!PEAR::isError($result)) { 
    4242                $emailArray = explode('@', $_POST['email']); 
    43                 $this->session->user = $emailArray[0]; 
    44                 $this->session->domain = $emailArray[1]; 
    45                 $this->session->email = $_POST['email']; 
    46                 $this->session->password = Framework_User_passEncryption::encryptPass($_POST['password'],  
    47                     (string)Framework::$site->config->mcryptKey); 
     43                $this->session->__set('user', $emailArray[0]); 
     44                $this->session->__set('domain', $emailArray[1]); 
     45                $this->session->__set('email', $_POST['email']); 
     46                $this->session->__set('password', Framework_User_passEncryption::encryptPass($_POST['password'],  
     47                    (string)Framework::$site->config->mcryptKey)); 
     48                $this->session->__set('lastActionTime', time()); 
    4849                header("Location: ./index.php?module=Domains"); 
    4950            } else { 
    5051                $this->setData('loginError', $result->getMessage()); 
    5152                $this->setData('QF_Form', $form->toHtml()); 
    52                 $this->session->email = null
    53                 $this->session->password = null
     53                $this->session->__set('email', null)
     54                $this->session->__set('password',  null)
    5455                return; 
    5556            } 
     
    7677    } 
    7778 
     79    function logoutNow() { 
     80        $this->session->destroy(); 
     81        $this->setData('message', _('Logged out successfully')); 
     82        return $this->__default(); 
     83    } 
     84 
     85    function logoutInactive() { 
     86        $this->session->destroy(); 
     87        $this->setData('message', _('You have been logged out automatically for inactivity')); 
     88        return $this->__default(); 
     89    } 
     90 
    7891} 
    7992 
  • trunk/Framework/Site/Default/config.xml

    r130 r136  
    11<?xml version="1.0" ?> 
    22<framework> 
     3    <!-- set to 1 to send debug info to logFile --> 
     4    <debug>0</debug> 
    35    <vpopmaildHost>home.shupp.org</vpopmaildHost> 
    46    <vpopmaildPort>89</vpopmaildPort> 
    5     <debug>0</debug> 
     7    <!-- inactivity timeout - in seconds --> 
     8    <inactiveTimeout>300</inactiveTimeout> 
    69    <mcryptKey>My Secret Key</mcryptKey> 
    710    <maxPerPage>10</maxPerPage>