protected function refreshSession()
    {
        //  Get the user; be wary of admin's logged in as other people
        $oSession = Factory::service('Session', 'nails/module-auth');
        if ($this->wasAdmin()) {

            $recoveryData = $this->getAdminRecoveryData();

            if (!empty($recoveryData->newUserId)) {
                $me = $recoveryData->newUserId;
            } else {
                $me = $oSession->getUserData('id');
            }

        } else {
            $me = $oSession->getUserData('id');
        }

        //  Is anybody home? Hello...?
        if (!$me) {
            $me = $this->me;
            if (!$me) {
                return false;
            }
        }

        $me = $this->getById($me);

        // --------------------------------------------------------------------------

        /**
         * If the user is isn't found (perhaps deleted) or has been suspended then
         * obviously don't proceed with the log in
         */

        if (!$me || !empty($me->is_suspended)) {
            $this->clearRememberCookie();
            $this->clearActiveUser();
            $this->clearLoginData();
            $this->bIsLoggedIn = false;
            return false;
        }

        // --------------------------------------------------------------------------

        //  Store this entire user in memory
        $this->setActiveUser($me);

        // --------------------------------------------------------------------------

        //  Set the user's logged in flag
        $this->bIsLoggedIn = true;

        // --------------------------------------------------------------------------

        //  Update user's `last_seen` and `last_ip` properties
        $oDb    = Factory::service('Database');
        $oInput = Factory::service('Input');

        $oDb->set('last_seen', 'NOW()', false);
        $oDb->set('last_ip', $oInput->ipAddress());
        $oDb->where('id', $me->id);
        $oDb->update($this->table);

        return true;
    }
protected function refreshSession()
    {
        //  Get the user; be wary of admin's logged in as other people
        $oSession = Factory::service('Session', 'nails/module-auth');
        if ($this->wasAdmin()) {

            $recoveryData = $this->getAdminRecoveryData();

            if (!empty($recoveryData->newUserId)) {
                $me = $recoveryData->newUserId;
            } else {
                $me = $oSession->getUserData('id');
            }

        } else {
            $me = $oSession->getUserData('id');
        }

        //  Is anybody home? Hello...?
        if (!$me) {
            $me = $this->me;
            if (!$me) {
                return false;
            }
        }

        $me = $this->getById($me);

        // --------------------------------------------------------------------------

        /**
         * If the user is isn't found (perhaps deleted) or has been suspended then
         * obviously don't proceed with the log in
         */

        if (!$me || !empty($me->is_suspended)) {
            $this->clearRememberCookie();
            $this->clearActiveUser();
            $this->clearLoginData();
            $this->bIsLoggedIn = false;
            return false;
        }

        // --------------------------------------------------------------------------

        //  Store this entire user in memory
        $this->setActiveUser($me);

        // --------------------------------------------------------------------------

        //  Set the user's logged in flag
        $this->bIsLoggedIn = true;

        // --------------------------------------------------------------------------

        //  Update user's `last_seen` and `last_ip` properties
        $oDb    = Factory::service('Database');
        $oInput = Factory::service('Input');

        $oDb->set('last_seen', 'NOW()', false);
        $oDb->set('last_ip', $oInput->ipAddress());
        $oDb->where('id', $me->id);
        $oDb->update($this->table);

        return true;
    }
protected function refreshSession ( ) { //  Get the user; be wary of admin's logged in as other people $ oSession = Factory :: service ( 'Session' , 'nails/module-auth' ) ; if ( $ this -> wasAdmin ( ) ) { $ recoveryData = $ this -> getAdminRecoveryData ( ) ; if ( ! empty ( $ recoveryData -> newUserId ) ) { $ me = $ recoveryData -> newUserId ; } else { $ me = $ oSession -> getUserData ( 'id' ) ; } } else { $ me = $ oSession -> getUserData ( 'id' ) ; } //  Is anybody home? Hello...? if ( ! $ me ) { $ me = $ this -> me ; if ( ! $ me ) { return false ; } } $ me = $ this -> getById ( $ me ) ; // -------------------------------------------------------------------------- /**
         * If the user is isn't found (perhaps deleted) or has been suspended then
         * obviously don't proceed with the log in
         */ if ( ! $ me || ! empty ( $ me -> is_suspended ) ) { $ this -> clearRememberCookie ( ) ; $ this -> clearActiveUser ( ) ; $ this -> clearLoginData ( ) ; $ this -> bIsLoggedIn = false ; return false ; } // -------------------------------------------------------------------------- //  Store this entire user in memory $ this -> setActiveUser ( $ me ) ; // -------------------------------------------------------------------------- //  Set the user's logged in flag $ this -> bIsLoggedIn = true ; // -------------------------------------------------------------------------- //  Update user's `last_seen` and `last_ip` properties $ oDb = Factory :: service ( 'Database' ) ; $ oInput = Factory :: service ( 'Input' ) ; $ oDb -> set ( 'last_seen' , 'NOW()' , false ) ; $ oDb -> set ( 'last_ip' , $ oInput -> ipAddress ( ) ) ; $ oDb -> where ( 'id' , $ me -> id ) ; $ oDb -> update ( $ this -> table ) ; return true ; }
Refresh the user's session from the database

@return boolean
Refresh the user s session from the database