Link to home
Start Free TrialLog in
Avatar of fskilnik
fskilnikFlag for Brazil

asked on

Javascript to allow login/password authorization

Hi there!

I know nothing about Javascript, but after googling and using some logic I was able to create a form and a "button" to run on an HTML page, in which the user fills the form with his login and password, and then he/she is redirected to the google page successfully.

This is the code, except for some "class" tags that I believe are irrelevant to the question:

---------------------------------------------------------------------------------------------------------------

<form data-form-output="form-output-global" method="post">
       <input id="login-your-login" placeholder="Login" type="text" name="login" data-constraints="@Required" > </div>
       <input id="login-your-password" placeholder="Password" type="password" name="password" data-constraints="@Required"></div>
 <input type="button" name="theSubmitButton" id="theSubmitButton" value="Log in" onClick="window.location = 'http://google.com';">
 </form>

---------------------------------------------------------------------------------------------------------------

Now I would like to substitute the window.location string to a page in the "pos-login" area of the website, but I need to pass the login and password typed by the user so that I am able to check and authorize his/her access, this authorization to be done in the page to which the user is redirected. (This one will be a pure asp one, not an html page, and from there I feel much more comfortable.)

All that put, the question I guess is already clear:

Could you please make the proper changes in the code offered, so that when the user clicks the button we will have the login and password availables for authorization?

I guess we could do it with the following idea:

onClick="window.location = 'http://google.com?UserLogin=login&UserPassword=password';" but I cannot create this by myself.

My intention is that, when the user is redirected to the next  (.asp) page, I will be able to have the login and password strings for "analysis", using something like

Dim userLogin, userPassword

userLogin = CStr(Request.Form("login"))
userPassword =  CStr(Request.Form("password"))

right in the very beginning of the .asp page, and then I could proceed from there...

I hope I got myself understood.

I am not dealing with sensitive information, but if we can avoid passing user/password in the string, I guess it would be better!

Thanks a lot!
fskilnik
ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fskilnik

ASKER

Hi there!

I´m sorry for the small delay in this return:

@Big Monty :: excellent solution and explanation (as usual). You have already helped me A LOT during all these years... I am really grateful for that and I hope I have more opportunities to be "saved by your expertise" in the future!

@Julian Hansen :: excellent links and info. I will learn a lot through (carefully studying) them, for sure. (I am MUCH more used to idempotence in math than in computing...)

I hope to be fair on my best/assisted solution and point splitting.

Thanks you both and have a great 2017!
Fabio.
glad I can help :)