PDA

View Full Version : Login CFform - redirection ???


Moises
11-22-2006, 10:40 PM
Hi, I developing a login form with CF MX and flashforms.

Well, I have my login page and my component where I do the authentification.

So I have all the process but when I already authenticated I don't kno how to redirect to my main page in actionscript code. In CF there is a cflocation tag but I don't know ig there is a commanda in action script to redirect a page.

I hope you can help me.

Here is may code:


<cfsilent>
<cfsavecontent variable="Auth">
<cfoutput>
//create connection
var connection:mx.remoting.Connection = mx.remoting.NetServices.createGatewayConnection("http://#cgi.HTTP_HOST#/flashservices/gateway/");
//declare service
var myservice:mx.remoting.NetServiceProxy;
var componentPath:String = "proveedores.components.security";
</cfoutput>

var responseHandler = {};
var editArguments:Object = {};
<!--- put controls in the responseHandler's scope --->

<!--- handle create response --->
responseHandler.onResult = function( results: Object ):Void {

mx.managers.CursorManager.removeBusyCursor();

if (results.status == 'true') {
_root.actionMessage.text="Username and Password Authenticated Successfully";

// Here I want to redirect to my main page, how do I do that?

}
else {
_root.actionMessage.text='Username and/or Password was incorrect!';
}
//show a message
//alert(results.status);

}
responseHandler.onStatus = function( stat: Object ):Void {
//if there is any error, show an alert
alert("Error while calling cfc:" + stat.description);
}

//get service
myservice = connection.getService(componentPath, responseHandler );



editArguments.username = username.text;
editArguments.password = password.text;

<!--- only make call if all required fields are supplied --->
if( mx.validators.Validator.isStructureValid(this, 'checkAuth') ){
<!--- show clock cursor --->
mx.managers.CursorManager.setBusyCursor();
//make call
myservice.authenticate(editArguments);


}
</cfsavecontent>
</cfsilent>



<cfform name="checkAuth" method="post" format="flash">
<cfformgroup type="panel" label="Firmarse" width="255" height="200">
<cfinput name="username" type="text" label="Usuario:" size="15" required="yes" message="Se requiere el usuario">
<cfinput name="password" type="password" label="Clave" size="15" required="yes" message="Se requiere el password">
<cfformgroup type="horizontal">
<cfinput type="button" name="checkAut" value="Accesar" onclick="#auth#" >
<cfinput type="button" name="btnRegistra" value="Registrarse">
</cfformgroup>


<cfformitem type="text" id="actionMessage" style="fontWeight:bold; color:red;" width="210"></cfformitem>

</cfformgroup>
</cfform>