codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Validating multiple passwords  Jaganath at 12:13 on Tuesday, August 29, 2006
 

Hi - I know very little about javascript and I've been tasked with creating a form which validates the entries in 5 different password fields as well as other fields such as email etc.

The idea is that you have to enter 5 correct and different passwords into the form and only if all 5 are correct will you be forwarded to a thank you page.

If any of the passwords are wrong you will get an error message and the incorrect field(s) will be highlighted.

Any ideas as where to start on this?

  Re: Validating multiple passwords  S_Flex at 13:19 on Tuesday, August 29, 2006
 

Most javascript loging are not secure. 90% of the javascript logings i have seen are easy to pass.

to make it hard you will have to store the passwords in a location that only the javascript can read, which is kinda hard to do.
maybe using .htaccess file on the server to block web browsers the right to read it.

Or encode the passwords with an encryption and when the passwords typed are matched they are encrypted then matched with the good passwords that are encrypted also, for this way you should use a one way encryption like md5 or SHA so its harder to decode the encoded passes.

But if your looking for a secure login Perl, PHP, asp are langs to look into.



  Re: Validating multiple passwords  S_Flex at 13:22 on Tuesday, August 29, 2006
 

but if the location you want secure is viewable in the javascript a hacker could bypass the hole code and go straight to the hidden location.

  Re: Validating multiple passwords  Jaganath at 13:26 on Tuesday, August 29, 2006
 

Hi - security isn't such a big issue for this project - the 5 passwords thing is more of a gimic - as long as the passwords are in a seperate .js file then that's ok. Where I'm stuck is writing a function that firstly validates the user input against the specific password strings and writing it so that if any one of the 5 passwords is wrong the sumbit fails.

  Re: Validating multiple passwords  S_Flex at 13:46 on Tuesday, August 29, 2006
 

Ok well this is about what your looking for. I`m not sure in javascript if && meens and in the if statments i made but thats just a little bit of editing to change that...


var Value1
var Value2
var Value3
var Value4
var Value5

var Checked

function verify(Value1,Value2,Value3,Value4,Value5)
{
if (Value1 == "N")
{
Checked = 1;
} else { window.location.href="/forum/Error.htm"; }
if (Checked == 1 && Value2 == "W")
{
Checked = 2;
} else { window.location.href="/forum/Error.htm"; }
if (Checked == 2 && Value3 == "E")
{
Checked = 3;
} else { window.location.href="/forum/Error.htm"; }
if (Checked==3 && Value4 == "S")
{
Checked = 4;
} else { window.location.href="/forum/Error.htm"; }
if (Checked==4 && Value5 == "S")
{
Checked = "PASSED";
} else { window.location.href="/forum/Error.htm"; }
if (Checked=="PASSED")
{
window.location.href="/forum/PASSED.htm";
} else { window.location.href="/forum/Error.htm"; }
}

now to use the function

verify(document.form_name.value1.value,document.form_name.value2.value,document.form_name.value3.value,document.form_name.value4.value,document.form_name.value5.value);

valueX is the name of the form input value

This should work, Sorry i didnt test it..

Flex,

  Re: Validating multiple passwords  Jaganath at 13:57 on Tuesday, August 29, 2006
 

Excellent - thanks for your help, I'm off to play with the code :)








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Header Frame ?
•  Re: Adhyayan - Annual Student Conference and Online Coding Festival
•  Re: calling C# from javascript
•  Re: Gidview row disable
•  Re: Knowing how to get TaylorMade R11 Irons
•  Re: refresh parent after closing pop up window
•  TaylorMade RocketBallz RBZ Driver will travel long and low
•  Supposedly the TaylorMade R11 Irons are supposed
•  TaylorMade R11s Fairway Wood


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2012