Changeset 666

Show
Ignore:
Timestamp:
05/19/07 04:31:29 (6 years ago)
Author:
lmajano
Message:

Ticket #156
Updated

Location:
coldbox/trunk/samples/applications/sampleloginapp
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • coldbox/trunk/samples/applications/sampleloginapp/config/config.xml.cfm

    r457 r666  
    2222                <Setting name="HandlersIndexAutoReload" value="false"/> 
    2323                <Setting name="ConfigAutoReload"                value="false"/> 
     24                <Setting name="HandlerCaching"                  value="false"/> 
    2425        </Settings> 
    2526 
  • coldbox/trunk/samples/applications/sampleloginapp/handlers/ehGeneral.cfc

    r501 r666  
    2121                <cfscript> 
    2222                        var rc = Event.getCollection(); 
     23                        var loggingIn = false; 
     24                        var oSession = getPlugin("sessionstorage"); 
     25                         
    2326                        //Set xeh's 
    2427                        rc.xehLogout = "ehGeneral.doLogout"; 
    2528                        rc.xehHome = "ehGeneral.dspHome"; 
     29                         
     30                        //Are we logging In 
     31                        if ( event.getCurrentEvent() eq "ehGeneral.doLogin" ) 
     32                                loggingIn = true; 
     33                         
    2634                        //Login Check 
    27                         if ( (not isDefined("session.loggedin") or not session.loggedin) and not rc.event eq "ehGeneral.doLogin" ) 
     35                        if ( (not oSession.exists("loggedin") or not oSession.getVar("loggedin") ) and not loggingIn ){ 
     36                                //Override the incoming event. 
    2837                                Event.overrideEvent("ehGeneral.dspLogin");               
     38                        } 
    2939                </cfscript> 
    3040        </cffunction> 
     
    6979                                if ( ValidationStruct.validated ){ 
    7080                                        //Login Correct. 
    71                                         //set my session var 
    72                                         session.loggedin = true; 
    73                                         session.name = ValidationStruct.qUser.name; 
     81                                        //set my session vars 
     82                                        getPlugin("sessionstorage").setVar("loggedin",true); 
     83                                        getPlugin("sessionstorage").setVar("name",ValidationStruct.qUser.name); 
     84                                        //Log the entry 
    7485                                        getPlugin("logger").logEntry("information","The user #validationStruct.qUser.name# has now logged in."); 
     86                                        //relocate to home page. 
    7587                                        setNextEvent("ehGeneral.dspHome"); 
    7688                                } 
     
    105117                        //Log it 
    106118                        getPlugin("logger").logEntry("information","User: #session.name# logged out successfully."); 
     119                         
    107120                        //Delete login INformation 
    108                         structdelete(session, "loggedin"); 
    109                         structdelete(session, "name"); 
     121                        getPlugin("sessionstorage").deleteVar("loggedin"); 
     122                        getPlugin("sessionstorage").deleteVar("name"); 
     123                         
    110124                        //Set the next event to display 
    111125                        setNextEvent("ehGeneral.dspLogin");