Think of something that you wish Authorware could do but it doesn't?  Let the our good friends at Macromedia know via the wishlist.

Please let us know if you find any of the materials on this site inappropriate or offensive. Please include the url and why the material should be reviewed.

Comments and questions about the site are also welcome. Please no Authorware questions, use the AWARE list.


B1001 - How do I set up a secure password entry system?

by - Joseph Ganci

I'd like to set up a password entry system. I would like the characters the user types NOT to be shown on the screen. What if I want an asterisk or some other character to be shown for each keypress instead?-- Asked by several  

Ah, yes, the famous password entry question. I get this one a lot. There are several different ways to set up this kind of interaction. Here is a very simple one.   Owen Chamberlin sent me an improved version which you can download from our Downloads area.

The first Calculation icon contains the short script:

    password := fakepass := ""
which just resets the contents of two variables to be empty. The first is password, which will contain the actual characters typed by the user. The second is fakepass, which will contain a string of asterisks, one for each character typed, and will be the variable shown on the screen. 

The display portion of the Interaction icon contains the text:  Password: {fakepass}  which lets the user see the asterisks as the password is typed. 

The two keypress responses trap first for the Enter or Return key, at which point we consider the password entry finished, or any other key as a valid password character. The contents of the first attached Calculation icon contains whatever code you normally would use to check the contents of the variable password to see if they constitute a valid password. The contents of the second attached Calculation icon contains the following script: 
    password := password ^ Key
    fakepass := fakepass ^ "*" 
The first line attaches whatever key is pressed to the current contents of the variable password. Note that this variable is never shown on the screen. It is used for password validation checking only. 

The second line attaches an asterisk to the variable fakepass which, if you recall, is being shown in the Interaction icon, so it gets immediately reshown on the screen. You could of course use a different character than an asterisk if you wish. In addition, the above does not take into account the pressing of the Backspace or the Delete keys. To take care of these, you would need to set up other response options above to check for those keys. 


Download the code from the Download area

There are 0 reviews
Add your review