Go Back   CodingForums.com > :: Client side development > JavaScript programming > Post a JavaScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 14 votes, 3.79 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-19-2002, 07:51 PM   PM User | #1
Borgtex
Regular Coder

 
Join Date: Aug 2002
Location: Spain
Posts: 420
Thanks: 0
Thanked 0 Times in 0 Posts
Borgtex is an unknown quantity at this point
Secure Login with javascript

Here is my "total secure login" script. Description of the contents:

login.htm: First page. It asks login and password, combines it (Login+Password) and sends it to the next page

auth.htm: checks for the existence of a Login+Password.js if yes (authorized user), it reads the private url and opens it, if not, it goes back to the first page, wich shows an error message

CodingForums.js: a Login+Password.js sample. You can have as many users as you want; one .js for every one (i.e. Login: Neo, Pwd: Matrix =NeoMatrix.js). Blocking an user access is as easy as deleting his .js file

page.htm:a sample destination page

PasswordHelper.vbs: a nice script that creates the js files

Of course, server side programming is much better if you have sensitive data to protect

Edited: Due the popularity of this script, I updated the original version with the one with whammy improvements, like the Password Helper
Attached Files
File Type: zip jslogin.zip (2.2 KB, 16636 views)
__________________
Don't resist to assimilation. Billions of Borgs can't be wrong!

Last edited by Borgtex; 11-07-2003 at 10:20 AM..
Borgtex is offline   Reply With Quote
Old 11-24-2002, 01:15 AM   PM User | #2
Ricky158
Regular Coder

 
Join Date: Aug 2002
Location: New York
Posts: 152
Thanks: 12
Thanked 0 Times in 0 Posts
Ricky158 is an unknown quantity at this point
Thumbs up

holy $*@&

i've been looking for a good password-gate-like thing for a loooooong time. this is awesome! i was about ready to post that i was having trouble, before i found out what to do. here's how i got it to work...

1) unzipped the files
2) uploaded ALL of them to my site
3) created a new "CoddingForums.js" page and renamed "CoddingForums"
4) in renamed "CoddingForums" page, paste all info from the text in the "CoddingForums.js" into the new, renamed page
5) thank borgtex for the awesome script

also, you've got to make sure the file name is "{Name}{Password}.js" no {}'s, no spaces, first letter of name and password is capitalized (or so i think. but i'm afraid to test). it works fine for me, doing the method above.

THANKS BORGTEX!!
Ricky158 is offline   Reply With Quote
Old 11-24-2002, 10:04 PM   PM User | #3
KaoS
New Coder

 
Join Date: Nov 2002
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
KaoS is an unknown quantity at this point
is it possible to make the usernames be in a drop down box instead of typing them in, if so how???
KaoS is offline   Reply With Quote
Old 11-25-2002, 10:53 PM   PM User | #4
Ricky158
Regular Coder

 
Join Date: Aug 2002
Location: New York
Posts: 152
Thanks: 12
Thanked 0 Times in 0 Posts
Ricky158 is an unknown quantity at this point
hmmm... let's use My Yahoo! for example. does Yahoo! have a drop-down menu listing ALL of their members' usernames? wasnt like that the last time I checked... so i think it would just be more appropriate (in any case) for it to just be a type-in thing. because in my case, i use that script so it's harder for someone to access a certain page. giving them half of the entry information needed to access the page doesnt really help.

but you can do what you want with the script, but i have such little knowledge of javascript that i can't help you. but hey, i know the comment tag: // yay!
Ricky158 is offline   Reply With Quote
Old 11-25-2002, 10:57 PM   PM User | #5
KaoS
New Coder

 
Join Date: Nov 2002
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
KaoS is an unknown quantity at this point
im not going to have 2143446 members only about 6 lol
KaoS is offline   Reply With Quote
Old 11-26-2002, 02:26 AM   PM User | #6
Borgtex
Regular Coder

 
Join Date: Aug 2002
Location: Spain
Posts: 420
Thanks: 0
Thanked 0 Times in 0 Posts
Borgtex is an unknown quantity at this point
Just change the textbox for a dropdown menu, and access the value of the selectedIndex.
If you're not familiar with dropdowns & javascript, post your question in the JavaScript programming forum
__________________
Don't resist to assimilation. Billions of Borgs can't be wrong!

Last edited by Borgtex; 11-26-2002 at 02:29 AM..
Borgtex is offline   Reply With Quote
Old 12-25-2002, 11:23 AM   PM User | #7
SYP}{ER
Regular Coder

 
Join Date: Jun 2002
Location: Ontario, Canada
Posts: 183
Thanks: 0
Thanked 0 Times in 0 Posts
SYP}{ER is an unknown quantity at this point
If your data is that important, use .htaccess & .htpasswd to keep the unwanted out.

If someone wants to get in, and has intermediate to advanced knowledge of javascript, they can and will
__________________
Offtone.com - In the works...
SYP}{ER is offline   Reply With Quote
Old 12-25-2002, 11:47 AM   PM User | #8
krycek
Regular Coder

 
Join Date: Nov 2002
Location: Bristol, UK
Posts: 932
Thanks: 0
Thanked 0 Times in 0 Posts
krycek is an unknown quantity at this point
Just a warning: like SYP}{ER said, it is impossible to have a secure system using JavaScript alone.

A good system would be on the server side, or use .htaccess, or both.

But all the same, well done Borgtex for providing something that people want

Merry Christmas Everyone!

::] krycek [::
__________________
ithium | SOAPI | SDP | PTPScript manual
"ithium is a non-profit webhost, which is pretty much unique. The mission of ithium is to provide free hosting resources for worthwhile and needy non-profit projects, which otherwise may not be able to obtain such facilities. The money from commercial customers goes to maintain ithium's servers and further development."
krycek is offline   Reply With Quote
Old 12-31-2002, 12:00 AM   PM User | #9
Alex Vincent
Moderator


 
Join Date: May 2002
Location: Hayward, CA
Posts: 1,427
Thanks: 1
Thanked 19 Times in 17 Posts
Alex Vincent is on a distinguished road
Hm, sounds interesting. You have to download the authentication file from the server, or you're going nowhere. In this case, knowing JavaScript may not help very much -- because the password helps define the name of the script to request by HTTP.

Creating a dropdown menu is a security risk: it gives a person who wants in but isn't authorized a much narrower field of possible filenames to search.

Plus, there's always the possibility that a different combination of characters will yield a valid result (taking a letter off the password and sticking it on the username, for instance).
__________________
"The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
June 30, 2001
author, Verbosio prototype XML Editor
author, JavaScript Developer's Dictionary
https://alexvincent.us/blog
Alex Vincent is offline   Reply With Quote
Old 01-22-2003, 01:39 PM   PM User | #10
CrUdE
New Coder

 
Join Date: Jan 2003
Location: Belgium
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
CrUdE is an unknown quantity at this point
Nice thing dude

little question: is it possible to mark the password field with ***** when you type your password?
__________________
"Hell, there are no rules here-- we're trying to accomplish something."
Thomas A. Edison (1847 - 1931)

"Any fool can make a rule, and any fool will mind it."
Henry David Thoreau (1817 - 1862)
CrUdE is offline   Reply With Quote
Old 01-22-2003, 03:00 PM   PM User | #11
Borgtex
Regular Coder

 
Join Date: Aug 2002
Location: Spain
Posts: 420
Thanks: 0
Thanked 0 Times in 0 Posts
Borgtex is an unknown quantity at this point
yes, you only need to use this attribute in the password input:

<INPUT type="password" ...>
__________________
Don't resist to assimilation. Billions of Borgs can't be wrong!
Borgtex is offline   Reply With Quote
Old 01-22-2003, 03:03 PM   PM User | #12
CrUdE
New Coder

 
Join Date: Jan 2003
Location: Belgium
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
CrUdE is an unknown quantity at this point
OMG!!!!

Didn't thaught about that one.

anyway thankx m8 and keep up the good work.

another question.

Cos u r all leets in JS maybe I can ask u peeps to provide me with some good links to tutors etc. cos I'm not really into JS, and I'd like to be
__________________
"Hell, there are no rules here-- we're trying to accomplish something."
Thomas A. Edison (1847 - 1931)

"Any fool can make a rule, and any fool will mind it."
Henry David Thoreau (1817 - 1862)
CrUdE is offline   Reply With Quote
Old 01-22-2003, 04:31 PM   PM User | #13
redhead
Regular Coder

 
Join Date: Jun 2002
Location: United Kingdom Confused: Often
Posts: 859
Thanks: 0
Thanked 0 Times in 0 Posts
redhead is an unknown quantity at this point
Quote:
Originally posted by CrUdE
maybe I can ask u peeps to provide me with some good links to tutors etc. cos I'm not really into JS, and I'd like to be
www.javascriptkit.com has some good tutorials
__________________
redhead
redhead is offline   Reply With Quote
Old 01-23-2003, 03:32 AM   PM User | #14
relyt
Registered User

 
Join Date: Jan 2003
Location: CT
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
relyt is an unknown quantity at this point
err.....how would i make it so you can only view the website if you have entered the user name and password?

Last edited by relyt; 01-23-2003 at 03:46 AM..
relyt is offline   Reply With Quote
Old 01-23-2003, 08:53 AM   PM User | #15
CrUdE
New Coder

 
Join Date: Jan 2003
Location: Belgium
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
CrUdE is an unknown quantity at this point
I think making your index.htm the page with the javascript in it
__________________
"Hell, there are no rules here-- we're trying to accomplish something."
Thomas A. Edison (1847 - 1931)

"Any fool can make a rule, and any fool will mind it."
Henry David Thoreau (1817 - 1862)
CrUdE is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:48 AM.


Advertisement
Log in to turn off these ads.