PDA

View Full Version : password retrieval through email


ooiooipig
12-16-2002, 06:56 AM
to let user retrieve their password, i want to ask them to key in their email address then after that, if the entered email matches with the email that they enter when register, the password will be mailed to them via email. how can i make it such that the system will authenticate the email and then send to them automatically??

codefox
12-16-2002, 09:10 AM
Suppose you have a table user with the fields username, password, and email fields.
Now if a user forget his password, he could be asked to enter his username and the email he gave for contact during registration in a form. When he submits the form, the user name could be used as the search key to locate the corresponding email he entered during registration. Now compare that email with the email entered in the form. If the match send him a mail with his password. To send mails in asp you could use any email component. For example, if the the username and email textboxes are named txtUser and txtEmail, then

sSQL = "SELECT email FROM UserDetails WHERE username = " & txtUser

would give you the email corresponding the username.

If rs("email") = txtEmail Then
'SendMail
End If

ebco
12-16-2002, 09:11 AM
look at the ASP Email FAQs on aspfaqs.com CDONTS has its limitations - it can only be used on Windows NT Server

& check this url for cdosys http://www.aspheute.com/artikel/20000919.htm

ooiooipig
01-02-2003, 08:05 AM
Hi codefox, i still cant get the send password through email thing. can u help me see what's the problem??

<!--#include file = "topFrame.htm"-->
<%Session.Abandon%>

<html>
<head>
<title>Send Password</title>

<%
dim rs
dim conn

set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "C:\Inetpub\wwwroot\db\ebookstore.mdb"
set rs=Server.CreateObject("ADODB.recordset")
sql = "SELECT Email FROM Person where UserID = '&IdUser'"
rs.Open sql, conn

If rs("Email") = Request.form("EmailAdd") Then
'SendMail
End If

rs.close
conn.close
%>

<body>
<table width="68%" border="0">
<tr>
<td width="26%" height="63"><div align="center"><strong><font size="6">Password Retrieved!</font></strong></div></td>
</tr>
</table>

<table width="94%" height="284" border="0">
<tr>
<td width="52%"><img src="../images/nyp3.gif" width="424" height="320"></td>
<td width="48%"><table width="99%" height="365" border="0">
<tr>
<td align="center"><span style="letter-spacing: 1pt"><sup><font size="6"><strong>Success...</strong></font></sup></span></td>
</tr>
<tr>
<td align="center"><font face="Garamond"><strong>Your password has been sent to your email.<br>
Please check your email <br> and click link below to re-Enter.</strong></font></td>
</tr>
<tr>
<td height="50" align="center"></td>
</tr>
<tr>
<td align="center"><strong><font face="Garamond"><a href="login.asp"><strong><em> Re - Enter</em></strong></a></font></strong></td>
</tr>
<tr>
<td height="50" align="center"></td>
</tr>

</table>
</body>
</head>
</html>

Roelf
01-02-2003, 08:26 AM
Originally posted by ooiooipig
If rs("Email") = Request.form("EmailAdd") Then
'SendMail
End If


this part has to be programmed, you could use the cdonts thingy to do that, look at msdn.mocrosoft.com for details about how to use it, there are several threads in this forum about it too. do a search and use the information

codefox
01-02-2003, 11:38 AM
Do you plan to show a success message even if the email id doesn't match with the one in the database?

sql = "SELECT Email FROM Person where UserID = '&IdUser'"
What is &IdUser?

What exactly is not working? Are you not able to send mail?

ooiooipig
01-03-2003, 01:21 AM
this is the page where users key in their user id and email add to retrieve their password.
_______________________________________________________________________________

<%Session.Abandon%>
<basefont face="Comic Sans MS" color="black">
<html>
<head>
<title>Staffs' Password Retrieval Page</title>
<body bgcolor="#CCCCCC" background="../images/paper_b003.gif">

<form action="password1.asp" method="post" >
<center>
<h1><i><span style="letter-spacing: 1pt"><b><font face="Impact" size="5"><sup><font size="+7">the
</font></sup></font><font face="Impact" size="+7">E-BookStore</font></b></span></i><br>
Password Retrieval</h1><br><br>

<p> Please enter your UserID and email below:</p>

<table width="20%" border="0" align="center">
<tr>
<td width="6%">UserID:</td>
<td width="94%"> <input type="text" name="IdUser" size="15" maxlength="10"> </td>
</tr>
<tr>
<td width="6%">Email:</td>
<td width="94%"> <input type="text" name="EmailAdd" size="25" maxlength="40"> </td>
</tr>
<tr>
<td height="43"></td>
<td align="center"> <div align="right">
<input type="submit" name="Submit" value="Submit" >
<input name="reset" type="reset" id="reset" value="Clear">
</div></td>
</tr>
</table>
</form>


<div align="center">
<br><br><br>
<p><img src="../images/lines_blue_078.gif" width="570" height="11"></p>
<p><b><i><strong><em>You are now currently in the Password Retrieval Page</em></strong></i></b>
</p>
</div>

</body>
</html>

ooiooipig
01-03-2003, 01:24 AM
when the user submit their user id and email add, this page will validate and see if the user id and email add is valid. if so, then it will automatically send the password to the email.
____________________________________________________


<!--#include file = "topFrame.htm"-->
<%Session.Abandon%>

<html>
<head>
<title>Send Password</title>

<%
dim rs
dim conn

set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "C:\Inetpub\wwwroot\db\ebookstore.mdb"
set rs=Server.CreateObject("ADODB.recordset")
sql = "SELECT Email FROM Person where UserID = '&IdUser'"
rs.Open sql, conn

If rs("Email") = Request.form("EmailAdd") Then
'SendMail
End If

rs.close
conn.close
%>

<body>
<table width="68%" border="0">
<tr>
<td width="26%" height="63"><div align="center"><strong><font size="6">Password Retrieved!</font></strong></div></td>
</tr>
</table>

<table width="94%" height="284" border="0">
<tr>
<td width="52%"><img src="../images/nyp3.gif" width="424" height="320"></td>
<td width="48%"><table width="99%" height="365" border="0">
<tr>
<td align="center"><span style="letter-spacing: 1pt"><sup><font size="6"><strong>Success...</strong></font></sup></span></td>
</tr>
<tr>
<td align="center"><font face="Garamond"><strong>Your password has been sent to your email.<br>
Please check your email <br> and click link below to re-Enter.</strong></font></td>
</tr>
<tr>
<td height="50" align="center"></td>
</tr>
<tr>
<td align="center"><strong><font face="Garamond"><a href="login.asp"><strong><em> Re - Enter</em></strong></a></font></strong></td>
</tr>
<tr>
<td height="50" align="center"></td>
</tr>

</table>
</body>
</head>
</html>