Library tutorials & articles

Password Program in ColdFusion

Lost Passwords

What if you forget the password? Time to parse that database that you have just posted to...

<html>

<head>

<title>Forgotten Password Page</title>
<SCRIPT>
<!--
function testbox(form){
Ctrl=form.email;
if (Ctrl.value==""||Ctrl.value.indexOf('@',0)==-1){
return(false);
} else
return(true);
}
//-->
</SCRIPT>
</HEAD>

<body bgcolor="#FFFFFF">
<a href="index2.cfm"><FONT SIZE="4">BACK TO HOME PAGE</A></FONT><BR>

<h1 align="center">Did you forget your User Name and Password?</h1>
<br><font size=+1>
You will be emailed your username and password if it is added to our
database.<br>
To unsubscribe, email <a href="mailto:info@dautolink.com">info@dautolink.com</a>
and put unsubscribe in the subject line, and send.<br>
Register with Dautolink.com!!<br>
<br><br><br>
<hr>
<CFFORM NAME="forgot" METHOD="POST" ACTION="forgot2.cfm">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="90%">

<tr><td width="70%"><b>Choose a question in choice of a clue:</b></FONT></td>
<td width="30%"><select name="Clue">
<option value="What is your favorite color?">What is your favorite color?</OPTION>
<option value="What is the name of your favorite pet?">What is the name of your favorite pet?</OPTION>
<option value="What are the last five digits of your Social Security Number?">What are the last five digits of your Social Security Number?</OPTION>
</select>
</td>
</tr>
<tr>
<td width="50%"><B>CLUE ANSWER:</B></td>
<td width="50%"><cfinput type="text" name="Clue2" size="30" required="yes" message="Please give your Clue."></td>
</tr>
</b>
<tr>
<td width="50%"><b>EMAIL:</b></td>
<td width="50%"><cfinput type="text" name="email" required="yes" onvalidate="testbox" message="Invalid Email Entry." size="20" maxlength="20"></td>
</tr>
<tr>
<td width="28%"></td>
<td width="72%"></td>
</tr>
</b>

</table>
</center>
</div>
<p align="center">
<input type="Submit" value="Search"><input type="reset" value="Reset">
</CFFORM>

</body>

</html>


You will not be posted out for entering too many names, but the clue and email and clue answer must all jive, or no password and
username. Unlike many other password programs, you get the correct combo, and your UserName and Password are posted
as well as emailed. Saves some time. Here's the posted cfm page for the result of forgot1.cfm, forgot2.cfm...

<CFQUERY NAME="gilwayb" DATASOURCE="upload">

SELECT *
FROM passwd
WHERE CLUE2='#FORM.Clue2#' AND EMAIL='#FORM.email#'

</CFQUERY>

<html>
<head>
<title>
Password/Registration Request Approved</title>

</head>

<BODY bgcolor="#FFFFFF">
<a href="index2.cfm"><FONT SIZE="4">BACK TO LOGIN PAGE</A></FONT><BR><BR>

<CFMAIL TO= #Form.email#
CC="info@dautolink.com"
FROM= "info@dautolink.com"
SUBJECT= "Valid Registration and Password"
SERVER="mail.dautolink.com"
QUERY="gilwayb">

This is your valid username and password.
Thank you for choosing Dautolink.com. We will be in touch with you soon!
<CFOUTPUT>
Your Name: #LastName# #FirstName#

User Name: #UserName#

Password: #Password#
</CFOUTPUT>
</CFMAIL>

<b><font size=4>This is your Registration/Password Information.<br>
Keep it in a safe place.<BR>An email will be coming to your address shortly.<br>
If your clue and email are not yours, your name will not be posted on this page.<br>
Please contact Dautolink directly, or Re-Register.<br>
</b></font>
<br><hr>
<CFOUTPUT QUERY="gilwayb">
<b><font size=4>
Name: #LastName# #FirstName#<BR>
User Name: #UserName#<BR>
Password: #Password#<BR></B></FONT>
</CFOUTPUT>
<BR>
<a href="index2.cfm"><FONT SIZE="4">BACK TO LOGIN PAGE</A></FONT>
</body>
</html>

For those of you who are ColdFusion beginners, you can make just a plain posted to cfm page, and call it welcome.cfm, and have it do the same parsing work. I got fancy and wanted to protect all pages that say, were attempted to be directly accessed but no one had gone through the login page. Don't worry about it, it still works without the fancy deterrence ColdFusion but not as well. So for now, the posting page is login_action.cfm, which checks all things and decides if we should go to an error page or get into the site. Then the welcome.cfm page...

Comments

  1. 01 Jan 1999 at 00:00

    This thread is for discussions of Password Program in ColdFusion.

Leave a comment

Sign in or Join us (it's free).

Julia Lynne Green I have been a ColdFusion and ASP programmer for UPS in Watertown Massachusetts for the past two years, and for my own business, Julia Computer Consulting. I believe ColdFusion is the way of the fut...

Related podcasts

  • Crawlable Flash, Concurrent Python, Smart Robots.txt and more

    Mixed topics today Adobe works with Google, Yahoo and others to make Flash apps crawlable. Reddit.com open sources their codebase "Smart" robots.txt files - do you use them? Bruce Eckel article on concurrent Python with Twisted Railo - open source ColdFusion Cognifty - new PHP framework...

Want to stay in touch with what's going on? Follow us on twitter!