leading on from my last example which would be the best way to the following...
1) get the username from the database to store in a session
2) log them in
I was thinking about added the following in my handler after the validation
checks..
variables.adminUsersService.doLogin(userBean);//Login User
this passes in my userbean to adminUsersService...
<!---Login Request--->
<cffunction name="doLogin" access="public" returntype="any" output="false">
<cfargument name="bean" type="salesMaxx.model.objects.adminusers"
required="true" />
<cfscript>
var userDetails = variables.adminUsersGateway.readAdminUsers(arguments.bean);
bean.setUserSession();
</cfscript>
what i am not sure about is if I should be do this all in my service, or should
I come out again with the username and run the bean.setUserSession() in the
handler?
full handler below (with the bit above not in)
-----------------------------------------------------------------
var rc = event.getCollection();//RC Reference
var userBean = variables.adminUsersService.createAdminUserBean(); //Create
adminUserBean
var errors = "";
getPlugin('beanFactory').populateBean(userBean);//the magic bean machine
errors = userBean.validateUser();//Check For Validation Errors
if (NOT ArrayLen(errors)){//No Validation Errors
getPlugin('beanFactory').populateBean(userBean);
resultCount = variables.adminUsersService.validateCredentials(userBean);
//Check Login Credentials Does User Exist?
if (resultCount.IDEXISTS eq 1){
//LOG USER IN HERE???????????????????????????????????
}
else {
getPlugin("messagebox").setMessage("error", "Sorry,
Username/Password not found.");
}
}
else {//We Have Validation Errors Show The User A Message
getPlugin("messagebox").setMessage("error", "<b>The Following
Validation Errors Occurred:</b><br />",errors);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325473
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4