Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forgot your Password? 1

Status
Not open for further replies.

grx21

Programmer
Joined
Aug 3, 2001
Messages
45
Location
US
Hi,
I have created an app where the user has to enter his/her userid and password in order to gain access to the app. Additionally, I have been asked to create one of those "forgot your password?" features where if the user has forgotten his/her password it is emailed to him/her. Does anybody have any suggestions or ideas on how to create such thing?

Thanks,

GRX21
 
Here's mine:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>

<HTML>
<HEAD>
<TITLE>Forgot Password</TITLE>
</HEAD>

<!--- Define variables --->
<CFPARAM NAME=&quot;Posted&quot; DEFAULT=&quot;No&quot;>
<!--- Insert this code on any page sending email --->
<CFSET tzStruct = GetTimeZoneInfo()>
<CFSET DateString =
&quot;#DateFormat(Now(),'DDD, DD MMM YYYY')#&quot;
& &quot; #TimeFormat(Now(),'HH:mm:ss')#&quot;
& &quot; -&quot;
& &quot;#NumberFormat(tzStruct.utcHourOffset,'00')#&quot;
& &quot;00&quot;>

<!--- Get a list of employees from the database. --->
<CFQUERY NAME=&quot;GetEmployees&quot; DATASOURCE=&quot;#application.datasource#&quot;>
SELECT PersonID,
PersonFirstName,
PersonLastName
FROM PersonTable
WHERE PersonActive = Yes
ORDER BY PersonLastName
</CFQUERY>

<!--- Has the form been submitted? --->
<CFIF ISDEFINED(&quot;Form.Person&quot;)>
<CFSET POSTED = &quot;Yes&quot;>
</CFIF>

<BODY>

<CFOUTPUT>
<TABLE>
<TR>
<TD><CFINCLUDE TEMPLATE=&quot;MenuTable.cfm&quot;></TD>
</CFOUTPUT>
<TD CLASS=&quot;MainPage&quot;>
<!--- Insert main page info here. --->
<!--- If the form has been submited, insert the data and send success message. --->
<CFIF #POSTED# EQ &quot;Yes&quot;>
<CFQUERY NAME=&quot;GetPassword&quot;
DATASOURCE=&quot;#Application.Datasource#&quot;
DBTYPE=&quot;ODBC&quot;>
SELECT *
FROM PersonTable
WHERE PersonID = '#Form.Person#'
</CFQUERY>
<!--- Send email --->
<CFMAIL TO=&quot;#GetPassword.PersonFirstName# #GetPassword.PersonLastName# <#GetPassword.PersonEmail#>&quot;
FROM=&quot;Buzz&quot;
SUBJECT=&quot;Your password&quot;
TYPE=&quot;HTML&quot;>
<CFMAILPARAM NAME=&quot;Date&quot; VALUE=&quot;#DateString#&quot;>
Your password is #GetPassword.PersonPassword#.<BR><BR>
You may login <A HREF=&quot;#Application.RootPath#Directory/EditUser.cfm&quot;>here</A> and change your password.
</CFMAIL>
<CFOUTPUT>
<H2>Thank you, #GetPassword.PersonFirstName#!</H2>
<H3>You will be receiving an email containing your password shortly.</H3>
</CFOUTPUT>
<!--- If the form has not been submitted, present the form. --->
<CFELSE>
<DIV ALIGN=&quot;center&quot;>
<BR><BR>
<CFOUTPUT>
<FORM ACTION=&quot;#cgi.script_name#&quot; METHOD=&quot;POST&quot; ENCTYPE=&quot;multipart/form-data&quot;></CFOUTPUT>
<B>Please select your name from the list.</B><BR>
<SELECT NAME=&quot;Person&quot;>
<!--- Display every employee. --->
<CFOUTPUT QUERY=&quot;GetEmployees&quot;>
<OPTION VALUE=&quot;#PersonID#&quot;>#PersonFirstName# #PersonLastName#</OPTION>
</CFOUTPUT>
</SELECT>
<BR><BR>
<CFOUTPUT><INPUT TYPE=&quot;Submit&quot; VALUE=&quot;Send Password&quot;>
</FORM>
</CFOUTPUT>
</DIV>
</CFIF>
</TD>
</TR>
</TABLE>

</BODY>
</HTML>
Calista :-X
Jedi Knight,
Champion of the Force
 
Thanks Calista! I think that your example is a good start for me to understand how to do it. I REALLY appreciate your help!

--GRX21
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top