Password Program in ColdFusion

Lost Passwords

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



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

<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
To unsubscribe, email <a href="mailto:[email protected]">[email protected]</a>
and put unsubscribe in the subject line, and send.<br>
Register with!!<br>
<CFFORM NAME="forgot" METHOD="POST" ACTION="forgot2.cfm">
<div align="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>
<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>
<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>
<td width="28%"></td>
<td width="72%"></td>

<p align="center">
<input type="Submit" value="Search"><input type="reset" value="Reset">



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">

FROM passwd


Password/Registration Request Approved</title>


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

CC="[email protected]"
FROM= "[email protected]"
SUBJECT= "Valid Registration and Password"

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

User Name: #UserName#

Password: #Password#

<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>
<CFOUTPUT QUERY="gilwayb">
<b><font size=4>
Name: #LastName# #FirstName#<BR>
User Name: #UserName#<BR>
Password: #Password#<BR></B></FONT>
<a href="index2.cfm"><FONT SIZE="4">BACK TO LOGIN PAGE</A></FONT>

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...

You might also like...


About the author

Julia Lynne Green United States

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...

Interested in writing for us? Find out more.


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Before software should be reusable, it should be usable.” - Ralph Johnson