I'm trying to follow your example of the proLoginExample (SmartFox Pro 1.4) and believe there is a bug in it. The client code includes the following:
Code: Select all
smartfox.onExtensionResponse = function(resObj:Object)
{
if (resObj._cmd == "logOK")
{
// Login Successfull
_global.myName = resObj.name
gotoAndStop("chat")
}
else if (resObj._cmd == "logKO")
{
// Login Failed
_gloabl.isBusy = true
// Show an error window
var win = showWindow("errorWindow")
win.errorMsg.text = resObj.err
}
}
but the server side does not return a name property in resObject on success. If you run the example you will see that after logging in successfully the chat is displayed but the username in the top right of the page says 'undefined'.
This leads me to my question... what I was trying to do was trap the logon, validate the user against my database and then set some properties for the user based on the database response e.g. cankick, canbemuted, etc etc. The intention is to have all the user properties held on the server so that it doesn't matter if the client is hacked but also have them available on the client so they can be used to alter the options displayed to the user (e.g. if cankick is false then the menu won't show that option).
My question then : is the 'handleInternalEvent' for 'loginRequest' the right place to put this code (permissions are by user not room so I really only want to do this once per 'session') and if it is (1) how can I get access to the client object on the server in this event and (2) how can I get the permissions on the client side if they are set this way as the client object doesn't seem to be passed back here.
Thanks a lot for your help!
David