Changeset 666
- Timestamp:
- 05/19/07 04:31:29 (6 years ago)
- Location:
- coldbox/trunk/samples/applications/sampleloginapp
- Files:
-
- 2 modified
-
config/config.xml.cfm (modified) (1 diff)
-
handlers/ehGeneral.cfc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
coldbox/trunk/samples/applications/sampleloginapp/config/config.xml.cfm
r457 r666 22 22 <Setting name="HandlersIndexAutoReload" value="false"/> 23 23 <Setting name="ConfigAutoReload" value="false"/> 24 <Setting name="HandlerCaching" value="false"/> 24 25 </Settings> 25 26 -
coldbox/trunk/samples/applications/sampleloginapp/handlers/ehGeneral.cfc
r501 r666 21 21 <cfscript> 22 22 var rc = Event.getCollection(); 23 var loggingIn = false; 24 var oSession = getPlugin("sessionstorage"); 25 23 26 //Set xeh's 24 27 rc.xehLogout = "ehGeneral.doLogout"; 25 28 rc.xehHome = "ehGeneral.dspHome"; 29 30 //Are we logging In 31 if ( event.getCurrentEvent() eq "ehGeneral.doLogin" ) 32 loggingIn = true; 33 26 34 //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. 28 37 Event.overrideEvent("ehGeneral.dspLogin"); 38 } 29 39 </cfscript> 30 40 </cffunction> … … 69 79 if ( ValidationStruct.validated ){ 70 80 //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 74 85 getPlugin("logger").logEntry("information","The user #validationStruct.qUser.name# has now logged in."); 86 //relocate to home page. 75 87 setNextEvent("ehGeneral.dspHome"); 76 88 } … … 105 117 //Log it 106 118 getPlugin("logger").logEntry("information","User: #session.name# logged out successfully."); 119 107 120 //Delete login INformation 108 structdelete(session, "loggedin"); 109 structdelete(session, "name"); 121 getPlugin("sessionstorage").deleteVar("loggedin"); 122 getPlugin("sessionstorage").deleteVar("name"); 123 110 124 //Set the next event to display 111 125 setNextEvent("ehGeneral.dspLogin");
