Masking user passwords
When users enter their password, it should not be visible to anyone who might happen to be looking over the user's shoulder. This is an expected level of security. As shown in the following screenshot, not masking the password is unacceptable. This recipe shows you a method of masking the user's password as it is entered.
How to do it...
To accomplish our task, we will create two labels (one for the username and one for the password), three text entry fields (one for the username, a second for the unmasked password, and the third for the masked password). The masked password is the one we want displayed on the screen:
Create a
Username
: label for content.Create a
Password
: label for content.Create a text entry field and name it
fldUsername
.Create a text entry field and name it
fldMaskedPassword
.Create a text entry field and name it
fldUnmaskedPassword
. Set this field's visible property tofalse
.Add the following code to the
fldMaskedPassword
field:on keydown pKey put...