try another color scheme:


Go Back   TECH6.0 > Graphics and Designing > Dreamweaver


Implement Forgot Password Feature

This is a discussion on Implement Forgot Password Feature within the Dreamweaver section, part of the Graphics and Designing category; Forgotten Password Level: Beginner Requirements: DreamweaverMX, Access2000 Language: ASP VBScript Introduction This tutorial will run you through the simple process ...

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 17-02-2008, 04:54 PM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Nokia N70 Music Edition
Posts: 1,063
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default Implement Forgot Password Feature

Forgotten Password


Level: Beginner
Requirements: DreamweaverMX, Access2000
Language: ASP VBScript


Introduction


This tutorial will run you through the simple process of setting up a page that a user can use if they have forgotten their password. To send the password to the user, the user will have to enter their username, if correct the page will email the users password to their registered email address.

The email component used for this tutorial is Jmail, however, the tutorial has been written to allow you to easily use any component that your server might offer. Further reading of this tutorial shows how to use other components for this tutorial:


Step 1: Creating the table.


We will use one simple table for this tutorial.


tblUsers
- UserID (Primary Key, Autonumber)
- Username (Text)
- Password (Text)
- Email (Text)


As usual, it would be best to fill up this table with some relevant information, so enter some user details into it and we will be ready to go.


Step 2: Creating the page.


Now we have the table, create a new page called forgot.asp, on it, create a form, in that form a bit of text something like "Enter your password", beside the create a text field and name it "username", beside that create a button and finally a hidden field called "process" with the initial value of "true".






That is pretty much it for details on the page. Next we want to grab the information entered by the user and action it.


Step 3: Processing the form.


Create a recordset called rsUser as shown in the image below.






That will, as usual, create a nice new chunk of code in your code editor. So scroll up to that and have a look. Nice eh? Below that recordset code open a new code bracket and enter the code below.


Code:
<%
'Check if the form has been processed
If Request.Form("process")="true" Then
 'Check the recordset for a valid record
If Not rsUser.Eof Then
'Valid record, so proceed with the email
Call sSendReminder(rsUser("Email"), rsUser("Password"))
Response.Write "Your password has been sent to your inbox."
Else
'Not a valid record
Response.Write "Sorry, no user details were found for that username."
End If
End If
A quick run down of the code above tells us that first, the code checks to see if the form has been processed by looking for the value true in the form field process. If that is true, it then checks the recordset for a valid record based on the criteria we used to create the recordset. If a record is present in the recordset, that means the user has entered a username that has been matched in the user table, meaning we can then send the email to the user whose record is now live within the recordset. Phew, bit of a mouthful eh?
So from there we then need to send the actual email off to the user with the relevant details. You will notice a Call statement in there, this will call the subroutine that will are going to create to send the email to the user. This subroutine requires to pieces of information, the email address to send the mail to and the password, which is used within the body of the email.
So, as I said at the beginning I am using Jmail for this example, so below the final End If in the above code, continue with this code...


Code:
Sub sSendReminder(vEmail, vPassword)
Dim MyMail
Set MyMail = Server.CreateObject("JMail.SMTPMail")
With MyMail
.ServerAddress = "mail.yourdomain.co.uk"
.Sender = "You@YourAddress.co.uk"
.AddRecipient vEmail
.Subject = "Requested password."
.Body = "Your password is: " & vPassword
.Execute
End With
Set myMail=nothing
End Sub
%>
As you will once again see the subroutine requires two parameters, vEmail and vPassword, these are the only two things that will change in the actual action of the email. Look down a bit through that code and you will see where we implement the two parameters within the code.
Basically, to use this routine with another email component, it is simply a point of removing all the code between the opening and closing of the sub, eg.


Code:
 Sub sSendReminder(vEmail, vPassword)

End Sub
%>
...and entering in the code for another email component replacing the EMAIL TO requirement to the vEmail parameter and the body of the email with the subject text above.
As an example, here is the code you would use if you required the CDONTS script.


Code:
Dim myMail
Set myMail = Server.CreateObject ("CDONTS.NewMail")
myMail.From = "You@YourDomain.co.uk"
myMail.To = vEmail
myMail.Subject = "Requested password."
myMail.Body = "Your password is: " & vPassword 
myMail.Send
set myMail=nothing
Applying this technique to any other email component script should result in success.
Finally, just run the script and check it out. It will send a short but sweet email to the user with their password.
__________________
Always TAG and BOOKMARK your threads
Submit your site to TECH6 Directory

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter



Reply With Quote
  #2  
Old 20-05-2008, 03:25 AM
iBlake's Avatar

Techie
 
Name: Blake
Join Date: May 2008
Location: United States
Phone: Not in the list
Posts: 93
iBlake is on a distinguished road
Send a message via MSN to iBlake
Default

Thanks I used this.
__________________
My iPhone is better than yours...........

I Am Back!
Reply With Quote
  #3  
Old 20-05-2008, 12:38 PM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Nokia N70 Music Edition
Posts: 1,063
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default

There's one thing I'd like to recommend if you're actually using this !!

Its simply pulling off the password string in simple text format and emailing it to the corresponding email address in the table. So, this would only work if you are NOT encrypting passwords in the database... which is NOT a good practice now.

I think it would be a bit more of homework but for sure 100 times better for you and for your users if you start encrypting your passwords in the database.

In this case, to complete the forgot password request:-

  1. Do not forget to store encrypted passwords at registration.
  2. When somebody requests for forgot pass., do nothing instead send him an email to click on the confirmation link.
  3. The link in the email when followed, should generate a random password (storing it encrypted) and sent in en email.

This is the best way to do it and you'll find the same process in almost every site. I have implemented the whole process on my website. Earlier I used the same above process as my site was in ASP (unencrypted) but is in PHP now (encrypted). I'll soon put a complete tutorial to do so in total PHP. You would love it.
__________________
Always TAG and BOOKMARK your threads
Submit your site to TECH6 Directory

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter



Reply With Quote
  #4  
Old 20-05-2008, 05:18 PM
Spec_tray's Avatar

Moderator
 
Join Date: Feb 2008
Posts: 140
Spec_tray will become famous soon enoughSpec_tray will become famous soon enough
Default store encrypted passwords ..

mate....r u switching to PHP ?.....

About encrypt password i came to see one article may be helpful ..

http://www.webcheatsheet.com/ASP/md5..._passwords.php

have a look...


regards

spec_tray
__________________
" There are no failures - just experiences and your reactions to them.

New members Please read before u post
General Tech6 Rules !!!

CSS Validator | Markup Validator | RSS Validator
Reply With Quote
  #5  
Old 20-05-2008, 06:49 PM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Nokia N70 Music Edition
Posts: 1,063
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default

mate....r u switching to PHP ?....
Have already switched over to PHP Spec_tray.. and I'm loving it !! This site is currently hosted on Windows server just because I had another website written in ASP and wanted both to reside on 1 server, but few days back I finished off with converting it to PHP as well. Will soon be moving to linux now.

okayy... I went through the article..
by the way, I read somewhere that MD5 cryptographic hash function is not secure anymore coz its algorithm has already been ****ked. Even SHA1() isn't left secure.

I am using strong SHA256 algorithm for encrypting passwords in my DB which is considered highly secure.

Check out this implementation of SHA256 in PHP. I am using the same and works perfect.
__________________
Always TAG and BOOKMARK your threads
Submit your site to TECH6 Directory

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter



Reply With Quote
  #6  
Old 21-05-2008, 06:20 PM
Spec_tray's Avatar

Moderator
 
Join Date: Feb 2008
Posts: 140
Spec_tray will become famous soon enoughSpec_tray will become famous soon enough
Default

Waaaow......

Thats super Wwzy..(SHA256 in PHP),Now i know why u love php
I m also thinking abt that:wink:

I came to know about another method i.e RC4 Encryption Using ASP & VBScript Is it secure ?

Regards

Spec_tray
__________________
" There are no failures - just experiences and your reactions to them.

New members Please read before u post
General Tech6 Rules !!!

CSS Validator | Markup Validator | RSS Validator
Reply With Quote
  #7  
Old 21-05-2008, 06:42 PM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Nokia N70 Music Edition
Posts: 1,063
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default

I came to know about another method i.e RC4 Encryption Using ASP & VBScript Is it secure ?
Can't comment much on it as I have never used it myself.
Here's a script for testing RC4 encryption in ASP with the source code as well.

and this is what Wikipedia states about this algorithm:-

In cryptography, RC4 (also known as ARC4 or ARCFOUR) is the most widely-used software stream cipher and is used in popular protocols such as Secure Sockets Layer (SSL) (to protect Internet traffic) and WEP (to secure wireless networks). While remarkable for its simplicity and speed in software, RC4 is vulnerable to attacks when the beginning of the output keystream is not discarded, or a single keystream is used twice; some ways of using RC4 can lead to very insecure cryptosystems such as WEP.
__________________
Always TAG and BOOKMARK your threads
Submit your site to TECH6 Directory

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter



Reply With Quote
  #8  
Old 21-05-2008, 06:50 PM
Spec_tray's Avatar

Moderator
 
Join Date: Feb 2008
Posts: 140
Spec_tray will become famous soon enoughSpec_tray will become famous soon enough
Default

RC4 is vulnerable to attacks when the beginning of the output keystream is not discarded, or a single keystream is used twice; some ways of using RC4 can lead to very insecure cryptosystems such as WEP
As Said by webwizzy View Post
Thanks for this information and that link mate, will make more research on that...

and

happy coding
__________________
" There are no failures - just experiences and your reactions to them.

New members Please read before u post
General Tech6 Rules !!!

CSS Validator | Markup Validator | RSS Validator
Reply With Quote
  #9  
Old 27-05-2009, 05:43 AM
No Avatar

Learner
 
Join Date: May 2009
Posts: 11
SRBuckey5266 is on a distinguished road
Default

Very very nice tutorial, this is very good for beginners, haha, like me! I will enjoy using this, that is, If I get my Login and Registration working, lol! I will have to save a link of this when I get to this.

Also, very good guide, it has a good amount of content, and I hope you make more for beginner levels! ( Wich is me, lol! ) And if you decided to make a new guide, please make a Login and Registration system.
Reply With Quote
  #10  
Old 27-05-2009, 02:11 PM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Nokia N70 Music Edition
Posts: 1,063
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default

A complete Registration system tutorial already exists. Check out the Stickied threads in PHP/MySQL Forum.
__________________
Always TAG and BOOKMARK your threads
Submit your site to TECH6 Directory

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter



Reply With Quote
  #11  
Old 28-05-2009, 02:02 AM
No Avatar

Learner
 
Join Date: May 2009
Posts: 11
SRBuckey5266 is on a distinguished road
Default

Huh, I didn't see that forum, I'll check it out.
Reply With Quote
Reply

Bookmarks

Tags
asp, dreamweaver, forgot, md5, password, sha256


Thread Tools
Display Modes




All times are GMT +5.5. The time now is 08:55 AM.

Contact Us - Tech6.com - Link to Us - Advertise - Submit Site - Privacy Statement - TOS - Top