LOTUSSCRIPT/COM/OLE CLASSES


Examples: VerifyPassword method
This agent saves a password as an environment variable, first verifying any existing password.

Sub Initialize
 Dim session As New NotesSession
 Dim ws As New NotesUIWorkspace
 REM Verify password
 pwhashed$ = session.GetEnvironmentString("SecretPassword")
 If pwhashed$ <> "" Then
   pw$ = ws.Prompt(PROMPT_PASSWORD, "Password", _
   "Secret password")
   If Not session.VerifyPassword(pw$, pwhashed$) Then
     Messagebox "Password not correct",, "Verification failed"
     Exit Sub
   End If
 End If
 REM Create or change password
 pw$ = ws.Prompt(PROMPT_PASSWORD, "Password", _
 "New secret password")
 If pw$ = "" Then Exit Sub
 pwverify$ = ws.Prompt(PROMPT_PASSWORD, "Password", _
 "Verify new secret password")
 If pwverify$ = "" Then Exit Sub
 If pw$ = pwverify$ Then
   pwhashed$ = session.HashPassword(pw$)
   Call session.SetEnvironmentVar("SecretPassword", pwhashed$)
 Else
   Messagebox "Password not recorded",, "Verification failed"
 End If
End Sub

See Also