I'm am a newbie.  I am going to be implementing Mach-ii on one of our
major websites and I am currently working on the login features.  I
have setup a LoginPlugin along with a SessionFacade with help from the
wiki and forums.  I want to make sure that I am using my listeners
correctly, if I read the wiki tutorials correctly, the listeners
should not have any logic in them, they are just used to facilitate
the system with directions to the DAO and Gateway.

I setup an authentication function in the gateway which provides code
and user feedback then depending on if they were successful I have the
listener announce the home page or back to the login page.  This is
what I have so far.  Is this correct or should I move my if statement
out of the listener, and where to?

Thanks for any help...

== mach-ii.xml ==
<event-handler event="loginPersonnel" access="public">
        <event-mapping event="loginSucceeded" mapping="adminHome"
redirect="true" />
        <event-mapping event="loginFailed" mapping="login" redirect="true" />
        <notify listener="myagrilifeListener" method="authenticatePersonnel" /
>
</event-handler>


== Listener ==
<cffunction name="authenticatePersonnel" access="public"
output="false" returntype="void">
        <cfargument name="event" type="MachII.framework.Event"
required="true" />
        <cfset variables.results =
variables.myagrilifeGateway.authenticatePersonnel
(uin=arguments.event.getArg("uservalue"),
authentication=arguments.event.getArg("password") ) />
        <cfif variables.results.ResultCode EQ 200>
                <cfset exitEvent = "loginSucceeded" />
                <cfset getProperty("sessionFacade").setLoginStatus(true) />
                <cfset getProperty("sessionFacade").setUserID
(variables.results.UserID) />
        <cfelse>
                <cfset exitEvent = "loginFailed" />
                <cfset arguments.event.setArg("ResultMessages",
variables.results.ResultMessages) />
                <cfset arguments.event.setArg("ResultCode",
variables.results.ResultCode) />
        </cfif>
        <cfset announceEvent(exitEvent, arguments.event.getArgs()) />
</cffunction>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/
Wiki / Documentation / Tickets: 
http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/
-~----------~----~----~----~------~----~------~--~---

Reply via email to