7.1 Example Application Definition for the Test Application

The application definition for the PSL Password Test Application (PasswordTest.exe) provides an example of a typical Windows application definition, including error handling and changing the password. Remember, the password for this application is hard-coded to single when the application is closed and restarted. This can cause confusion when setting strong password policies and changing passwords. You must also create a password policy called PwdTestPolicy, according to the password policy defined in this application definition. The password policy must require a minimum of 6 characters, but no complex rules, in order to use single as a password.

Here is the sample application definition in its entirety. Following this application definition is the explanation of what each section does.

# Set Password Policy
RestrictVariable $Password PwdTestPolicy
# ==== BeginSection: Log on ====
Dialog

   Class "#32770"

   Ctrl #1001

   Title "Log on"

EndDialog

SetPrompt "Username =====>"
Type $Username #1001
SetPrompt "Password =====>"
Type $Password #1002
SetPrompt "Domain =====>"
Type $Domain #1003
Click #1
SetPrompt "Please enter your user name and password to access Password Test.  SecureLogin will remember and automatically log you on in future.  IT Help Desk
x4532"
# ==== EndSection: Log on ====

# ==== BeginSection: Log on failure ====
Dialog

   Class "#32770"

   Title "Log on failure"

EndDialog

# Read the error message and set it as a temporary variable, then clear it
ReadText #65535 ?ErrorMessage
Click #2

# If log on failed, display the current stored Username and Password and prompt the user to verify them, then retry log on
If "You have failed to log on." -In ?ErrorMessage
   DisplayVariables "Log on to Password Test failed. The password for this application must be single when it first starts. IT Help Desk x4532"
# Press Alt>F and L to invoke the logon box so the user doesn't have to.

   Type -Raw "\Alt+F" 

   Type -Raw "L" 

   Type $Username

   Type $Password

   Type $Domain

EndIf

# ==== EndSection: Log on ====

# ==== Begin Section: Change Password ====
# Change Password Dialog Box
Dialog
Class "#32770"
Title "Change Password"
EndDialog

# Backup password, fill in the old user name and password, then start the change password routine
Set ?PwdBackup $Password
Type $Username #1015
Type $Password #1004
ChangePassword ?NewPwd "Please enter a new password for this application."
Type ?NewPwd #1005
Type ?NewPwd #1006
Click #1
 
# Change password successful messageDialog

   Class "#32770"

   Ctrl #65535 "You have changed your password successfully." 

   Title "Change successful"

EndDialog

# Clear application owned message and accept new password
Click #2
Set $Password ?NewPwd
# ==== End Section: Change Password ====