Question:
How can I have the user’s password be reconfirmed before executing a command, so that it is guaranteed the user logged in is the same user executing the command?
Solution:
To do so, you must use Viewer‘s PasswordConfirm(mode) method in the same script executing the command. This method opens a dialog box that requires that the user currently logged in reconfirms their password. It returns TRUE if the password is reconfirmed; otherwise, it returns FALSE. By its turn, mode Boolean parameter determines whether the user must be logged out (TRUE) or not (FALSE) in case of confirmation failure.
If the dialog is closed via Cancel button, the function returns FALSE. If there is no user logged in, the function also returns FALSE, but the dialog box is not opened. If the password is typed incorrectly, the request is repeated up to three times. If the user types their password incorrectly more than three times, the dialog is closed and the function returns FALSE.
Example:
If Application.PasswordConfirm(True) Then
MsgBox ConfirmPassword method returns True”
Else
MsgBox ” ConfirmPassword method returns False”
End If