Title: Message
hi,
 
when you enter stuff into that login dialog, it gets sent to the web server and stored in the CGI environment. 
 
instead of using this:
 
<cfif cflogin.name EQ "myusername" and cflogin.password EQ "mypassword">
 
try this:
 
<cfif cgi.auth_user EQ "myusername" and cgi.auth_pass EQ "mypassword">
 
this should work ok for IIS at least, may or may not work under other web servers as the CGI implementation is often loosely interpreted by the various web server vendors.
 
cheers.
 
+--------------------------------------------------------------+
| Turn on your Revenue Stream...                               |
| Bolt on a Virtual Cash Register to your e-commerce site now. |
| VeriPay from Xilo Online: http://www.xilo.com/veripay        |
+--------------------------------------------------------------+
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Blake Foss
Sent: Thursday, 20 February 2003 12:14 PM
To: CFAussie Mailing List
Subject: [cfaussie] FW: WWW-Authentication

Just flipping this one back to the group.
 
Has anyone tried this technique and gotten it to work?
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Blake Foss - Web Foot Forward
Sent: Monday, 17 February 2003 12:02 AM
To: CFAussie Mailing List
Subject: [cfaussie] WWW-Authentication

Hi All,
 
Has anyone ever used the WWW-Authenticate 401 method to password protect a site?
 
I want to add a quick login within a staging site I am working on and instead of building a login form as per the norm I want the browser to pop up the username and password window like the windows basic authentication.
 
The code I am using is below,
 
 <cflogin>
 <cfif isDefined( "cflogin" )>
  <cfif cflogin.name EQ "myusername" and cflogin.password EQ "mypassword">
   <cfset roles = "user">
  </cfif>
 </cfif>
 
 <cfif isDefined( "roles" )>
  <cfloginuser name="#cflogin.name#" password="#cflogin.password#" roles="#roles#">
 <cfelse>
  <cfsetting enablecfoutputonly="yes" showdebugoutput="no">
  <cfheader statuscode="401">
  <cfheader name="WWW-Authenticate" value="Basic realm=""MySecurity""">
  <cfoutput>Not authorised</cfoutput>
  <cfabort>
 </cfif>
 </cflogin>
 
When I activate it on the server I get the pop up window asking for the username, password AND domain. I enter the username and password, correctly as embedded in the page and the thing just pops up the window again. I keep entering the username and password and it keeps happening. Now the server has locked me out. Oops!
 
Has anyone used this type of authentication with CF? If I can get it to work I will tie it into the database and do it properly. For some reason I just like the little pop up window and thought it would save some time over coding a form page as it will be removed when the site goes live. Looks like a blew that theory, I think I have spent more time figuring out this problem than doing it the way I know and have done before.
 
Thanks in advance,
 
Blake Foss
 
-----------------------------------------------------------------------------------
Blake Foss
Web Foot Forward
p: 61 2 9340 4401
f: 61 2 8080 8190
m: 0410 747 620
e: [EMAIL PROTECTED]
 
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/ ---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/
---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to