Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: JavaScript Password Prompt tutorial  (Read 1230 times)

0 Members and 1 Guest are viewing this topic.
JavaScript Password Prompt tutorial
« on: August 31, 2007, 09:21:37 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1645
This is a very old tutorial, that I felt like posting on ZFGC. It's not that I suggest you to use JavaScript for this, but more for people to practice their JavaScript skills.

---------


Password Prompt Tutorial


Requirement

- NotePad or another text edit program
- HTML Knowledge
- JS Beginner expierience


Tutorial

This turorial is about Javascript "Password Prompt's". Password prompts are prompts that looks like error messages, which has a textarea in it. In this tutorial, you'll learn how that work, and what you have to do for it.

Here you go, Run NotePad or another edit program. First, Start with a HTML Javascript code.

Code: [Select]
<script type="text/Javascript">
Then put 2 variables pass and answer. The pass variable is your pass, The answere is the prompt.

Code: [Select]
var pass = "(pass here)";
 var answer = "";

The code will start with the answer prompt, Use this code to open the prompt.

Code: [Select]
answer = prompt("Enter the password to continue", "", "Enter Password");
When you're done with the answer, You need to add the password on it. Use this code. This code will check your pass in the answer.


Code: [Select]
if (answer == pass)
{
 alert("Password Correct!");
 alert("Access Accepted, Welcome!");
 window.location = "http://(your site here)/logged.html";
}


If the pass is right, Your access would be granted. The next step is to check the password is wrong.


Code: [Select]
else if (answer != pass)
{
 alert("Password Incorrect!");
 alert("Access Denied, Go away!");
 window.location = "http://(your site here)/login.html";
}


Otherwise, if the pass is wrong, The script will redirect you back to the login page. Then end the script.


Code: [Select]
</script>

If it's not working, Reply for questions/comments.
Logged
  • Virtual Security

Dayjo

shut the fuck up donny.
Re: JavaScript Password Prompt tutorial
« Reply #1 on: September 06, 2007, 02:40:08 pm »
  • hungry..
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3602
Not at all secure, considering someone could just look at the source and see the password :S
Logged
  • My Blog
Re: JavaScript Password Prompt tutorial
« Reply #2 on: September 13, 2007, 07:56:23 am »
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 4588
Not at all secure, considering someone could just look at the source and see the password :S
Still, it does demonstrate how to use prompts with Javascript.
Logged
the a o d c
Re: JavaScript Password Prompt tutorial
« Reply #3 on: September 13, 2007, 09:47:18 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
Not at all secure, considering someone could just look at the source and see the password :S
he could use hashing algorithms to fix that issue, although they could still just copy the url it would have redirected too, which could then be defeated by checking the referral information, which could then be defeated by faking it.
Logged
Re: JavaScript Password Prompt tutorial
« Reply #4 on: September 18, 2007, 08:49:46 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1645
Not at all secure, considering someone could just look at the source and see the password :S
Still, it does demonstrate how to use prompts with Javascript.
Allright, AoDC, you get my point of this tutorial :)

Not at all secure, considering someone could just look at the source and see the password :S
he could use hashing algorithms to fix that issue, although they could still just copy the url it would have redirected too, which could then be defeated by checking the referral information, which could then be defeated by faking it.
That makes no sense, every JavaScript could be cracked since it's viewable in the source. I might also make a simple tutorial about doing this in PHP, for securing your page using a password form.
Logged
  • Virtual Security
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.067 seconds with 48 queries.

anything