I can not get my flash form to actually login into a ColdFusion application.
I have used Flash forms before for this purpose and had no trouble.
My form sends the login data and returns the AuthUser and the Roles.
This part works because I have tested it in flash and it returns the proper
results.
When I put the file into a ColdFusion application and test it I cant get it to
actually login.
This form can be tested at:
www.digitalrorschach.com/MembersArea.cfm
Username:Jillian Password:Jillian
Here is my ActionScript:
on(press) {
#include "NetServices.as"
#include "DataGlue.as"
if (inited == null)
{
inited = true;
NetServices.setDefaultGatewayUrl("http://localhost:8500/flashservices/gateway");
myconnection = NetServices.createGatewayConnection();
myconnection.setCredentials(_root.User1.text, _root.Password1.text);
myservice = myconnection.getService("Luciddaydreamer", this);
}
myservice.GetAuthUser();
function GetAuthUser_Result(result){
trace(result) // in testing this returns the expected results everytime
_global.Stats = "Web"
}
}
on(release) {
getURL("BravoBlueDreamer.cfm", "_self")
}
Here is my ColdFusion Code in GetAuthUser.cfm:
<cfif GetAuthUser() NEQ "">
<cfset LoggedStatus = ArrayNew(1)>
<cfset LoggedStatus[1] = "#GetAuthUser()#">
<cfset LoggedStatus[2] = #IsUserInRole("Webmaster")#>
<cfset Flash.result = LoggedStatus>
<cfelse>
<cfset Flash.result = "Not Logged In">
</cfif>
Here is the login structure in my Application.cfm:
<cflogin>
<cfif NOT IsDefined("cflogin")>
<cfelse>
<cfif cflogin.name IS "" OR cflogin.password IS "">
<cfoutput>
<p> </p>
<H2>You must enter text in both the User Name and Password fields</H2>
</cfoutput>
<cfinclude template="loginform.cfm">
<cfabort>
<cfelse>
<cfquery name="loginQuery" dataSource="#Request.DSN#">
SELECT UserID, Roles
FROM Login
WHERE
UserID = '#cflogin.name#'
AND Password = '#cflogin.password#'
</cfquery>
<cfif loginQuery.Roles NEQ "">
<cfloginuser name="#cflogin.name#" Password = "#cflogin.password#"
roles="#loginQuery.Roles#">
<cfelse>
<cfoutput>
<H2>Your login information is not valid.<br>
Please Try again</H2>
</cfoutput>
<cfinclude template="loginform.cfm">
<cfabort>
</cfif>
</cfif>
</cfif>
</cflogin>
Like I said I used this exact same file (making the appropriate changes) and
it works fine on another site.
Any thoughts?
Please?
Kelly
bluestix - 06 May 2004 12:21 GMT
I figured out a way easier way to do this:
var j_username = _root.Password.text
var j_paswword = _root.UserName.text
getURL("MyUrl.cfm", "POST")
CF_Admin - 07 May 2004 10:11 GMT
This might be silly of me to ask, but your posted code says:
NetServices.setDefaultGatewayUrl("http://localhost:8500/flashservices/gateway");
Did you change this to the proper URL? Also if your just testing locally, I
think a saw some posts that said to try using 127.0.01:8500 instead of
localhost... just a thought. I know with myself it's usually someting stupid
that I just didn't notice LOL ;)
CF_Admin - 07 May 2004 10:35 GMT
Sorry, missed the psrt about it actually returning the data... I cant even get
mine to do that! I started with using CF Application, but striped down to a
simple query in the course of debugging. Maybe you could help me. See my post:
[b]" Not Authorized!?!?!"[/b]
Thanks...
In the mean time maybe pondering your problem will help me (or at least
distract me so I can come back to it). I'll let you know If I figure it out.
CF_Admin - 07 May 2004 11:18 GMT
Looks like your site: www.digitalrorschach.com/MembersArea.cfm is down... I
registered and logged in fine, and was greatly enjoying browsing your
content... but now nothing. Are you using Access DB? That cn often crash and
take CF with it.
bluestix - 20 May 2004 14:40 GMT
Hi
Glad you like the site.
I am still working on it but the login works fine now.
I just finished a super complex remoting project for someone else too.
I added some new pages to my site if you want to check them out.
They can be seen in the members area
www.digitalrorschach.com
www.dekaydmedia.com
Kelly
Dekayd Media Inc.
kelly@dekaydmedia.com
jaded5150 - 20 May 2004 19:27 GMT
Question for ya. I'm attempting something similar, but I have my CFLogin
structure in application.cfm so it runs everytime I try to open a CFC service.
Some of the cfcs don't require a valid login, but here's my problem...
<cfif (validateUser.recordcount eq 1) and
(validateUser.password is hash(validateUser.salt & cflogin.password))>
<cfset userRoles = valueList(validateUser.roles)>
<cfloginuser name="#cflogin.name#" password="#cflogin.password#"
roles="#userRoles#">
<cfelse>
<!--- Send something to Flash saying login failed --->
<cfabort>
</cfif>
How do you catch that failure from the application.cfm in flash? It's just an
application.cfm getting ran...should I just move application.cfm into a set CFC
that gets called and then catch the error that way? This would be a nicer way,
but can't figure out how to get the application.cfm to report something to
Flash.