Consultor Eletrônico



Kbase 19114: How To Validate A Password Using SpeedScript
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   28/07/2004
Status: Unverified

GOAL:

How to validate a password using the SpeedScript langauge.

FACT(s) (Environment):

WebSpeed 2.x
WebSpeed 3.x

FIX:

The following example uses two HTML documents (you can use .r's as well) to perform this way of validating passwords. Follow these steps:
1) Create a blank HTML file and code it as follows:

<html>
<head>
<title>Password Example</title>
</head>
<body>
<form method="post" action="val.html">
Enter Password:<input type="password" name="pass" value=""><br>
<input type="submit" name="action" value="process">
</form>
</body>
</html>

2) Close and Save this file.

3) Create another blank HTML file and code it as follows:

<html>
<head>
<title>Password Page 2</title>
</head>
<body>
<script language="SpeedScript">

define variable pass as character.

if get-value("pass") = "mypass" then do:
{&out} "Accepted".
/* Could also run a .html or .r file from here using a run statement *
/
end.
else do:
{&out} "Denied".
/* Could also redirect the user to a .html or .r file from here using
a run statement */
end.
</script>
</body>
</html>

4) Close and Save this HTML file as val.html.

5) Run the first HTML file.

NOTE: The Post form method is used here because you are
dealing with passwords. Use of the Get method is not
recommended because that displays the value of your
password in the URL of your browser.

This example can be modified to have it query a table that contains user and password information for verification. Currently, the example is looking for a hard coded value "mypass".