Error getting tags :
error 404Error getting tags :
error 404 ask password | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
ask password
Basics
Expander triangle
Type
Command
Syntax

ask password [clear] question [with defaultAnswer] [titled windowTitle] [as sheet]

Introduced
1.0
Changed
2.0
Environment
Desktop,Web
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Displays a dialog box like the ask command, but with the characters the user types displayed as asterisks (*) for privacy.
Examples

ask password clear "Password for the remote server:"
ask password "Please log in." titled "Millenium Group Intranet"
ask password empty with savedPassword as sheet

Additional Comments
Expander triangle

Use the ask password command to provide privacy for the information the user types. For example, if the user is in a public place, the information might be seen by someone looking over his or her shoulder. This command encrypts the text the user types, so you can also use ask password to implement a secret password.

Parameters:

The prompt is a string (or any expression that evaluates to a string).

The defaultResponse is placed in the text box when the dialog box appears. If no defaultResponse is specified, the text box is empty when the dialog box appears.

The windowTitle, if specified, appears in the title bar of the dialog box. If no windowTitle is given, the title bar is blank.

Comments:

The encrypted contents of the text box is placed in the it variable. If the user cancels the dialog, the it variable is set to empty, and the result function returns "cancel".

If the ask password clear form is used, the text box is not encrypted, and the it variable contains whatever the user entered.

If the ask password...as sheet form is used, the dialog box appears as a sheet on OS X systems. On other systems, the as sheet form has no effect and the dialog box appears normally. Attempting to open a sheet from within another sheet displays the second stack as a modal dialog box instead.

Changes to Revolution:

The ask password...as sheet form was introduced in version 2.0.

User Comments
Expander triangle
User thumbnail
Devin Asay
StarStarStarStarStar
Sep 9, 2009
To use this command you need to have stored an encrypted password first. There is no way to match a non-encrypted passphrase. Here's a simple example. Developer decides on a password and produces the encrypted password back by entering in the message box:


answer password; put it
-- encrypted password appears in message box results

Now save that encrypted password in a custom property, say, the uPassword of the stack. For the end user, you just insert the ask password command in your code and compare the encrypted result to the result you stored:


ask password "Please enter the administrator password."
if it is empty then exit to top
if it = the uPassword of this stack then
# right password; proceed
else
# incorrect password
answer "Incorrect password. Please try again."
end if