| |||||||
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 ...
![]() |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| ||||
| ||||
|
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
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
%>
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 %> 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
Finally, just run the script and check it out. It will send a short but sweet email to the user with their password.
__________________ Would you like to Link To Us | Support TECH6 by going Premium Know more about me at Vinayaks.com | Follow TECH6 at Twitter |
|
#2
| ||||
| ||||
|
Thanks I used this.
__________________ My iPhone is better than yours........... I Am Back! |
|
#3
| ||||
| ||||
|
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:-
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.
__________________ Would you like to Link To Us | Support TECH6 by going Premium Know more about me at Vinayaks.com | Follow TECH6 at Twitter |
|
#4
| ||||
| ||||
|
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 |
|
#5
| ||||
| ||||
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.
__________________ Would you like to Link To Us | Support TECH6 by going Premium Know more about me at Vinayaks.com | Follow TECH6 at Twitter |
|
#6
| ||||
| ||||
|
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 |
|
#7
| ||||
| ||||
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:-
__________________ Would you like to Link To Us | Support TECH6 by going Premium Know more about me at Vinayaks.com | Follow TECH6 at Twitter |
|
#8
| ||||
| ||||
| 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 |
|
#9
| ||||
| ||||
|
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. |
|
#10
| ||||
| ||||
|
A complete Registration system tutorial already exists. Check out the Stickied threads in PHP/MySQL Forum.
__________________ Would you like to Link To Us | Support TECH6 by going Premium Know more about me at Vinayaks.com | Follow TECH6 at Twitter |
|
#11
| ||||
| ||||
|
Huh, I didn't see that forum, I'll check it out.
|
![]() |
| Bookmarks |
| Tags |
| asp, dreamweaver, forgot, md5, password, sha256 |
| Thread Tools | |
| Display Modes | |
| |