Here's an action button that enables you to easily ret/reset their Internet
password. This code permits the user to cancel the operation at
Performs user identity password verification to ensure someone else is not
masquerading as the user. Automatic checking to ensure the utility is being executed in an application
(mail file) on a server - to prevent using it on a local replica while
disconnected from the server. If it's running "local", it will not run,
and alerts the user he/she must execute it from their server mail file.
Requires an Internet password with a minimum length of 8 characters.
Verification of the chosen Internet password.
If the user does not have write-access to the Internet password field in their
Person document in the NAB, it will gracefully exit and alert them
the attempt to set their Internet password was unsuccessful, and to contact
a Notes administrator.
Caveat: If the user elects to "cancel" when presented with the dialog boxCode: Sub Click(Source As Button) ' Code by Bob Pratico of K2ITS Dim ses As New NotesSession Dim reg As New NotesRegistration Dim MyID As String Dim MyDir As String Dim charPos As Integer Dim serverName As NotesName Dim ndb, maildb As notesdatabase ' Check to ensure they are executing on the server and not a local
to verify his Notes password, the button will no longer work and repeatedly
presents an error message. The Notes registration is corrupt,
caused by canceling out of the "switchtoID" method. This is a known bug
listed in the Notes KnowleedgeBase . Solution is to simply have the user
replica; bail out if they are not running it on a server
Set maildb = ses.CurrentDatabase
serverN$ = maildb.Server
If serverN$ = "" Then
Messagebox "You cannot do this from a local replica of your
mailbox. You must execute this from your mailbox replica on the server",
16, "Sorry - must be run on the server"
Exit Sub End If ' Tell the user what's about to happen and ask if they want to continue
nRet = Messagebox ("This will allow you to set (or reset) your Internet
Password which is distinct from your Lotus Notes password and is used to "
_ & "access Domino web applications." & Chr(13) & Chr(13) & "You will
first be asked for your Lotus Notes password to verify your identity.
" _ & "Upon confirmation, you will be asked to specify an Internet password
of your choice with a minimum of 8 characters (case-sensitive). " _
& "After verifying your choice, the password will be recorded." & Chr
(13) & Chr(13) & "Do you wish to continue?", _ 36 , "Continue?") ' Bail out if they say "no" If nRet = 7 Then Exit Sub End If ' Build the filepath to the existing ID which we swtich to in order to
verify the user's identity
' If the keyfilename contains a backslash character, then it is a full
pathname and can be used as is. If keyfilename
' does not contain a backslash character then it is contained ' in the Notes default directory. This can be retrieved from the ' directory environment string. MyID = ses.GetEnvironmentString("KeyFilename", True) MyDir = ses.GetEnvironmentString("Directory", True) Dim nuserName As New NotesName(ses.UserName) NotesUserName = nuserName.Abbreviated charPos = Instr(1, MyID, "") If charPos = 0 Then ' Not found build_str = MyDir + "" + MyID Else build_str = MyID End If ' If the user cancels the password prompt, then an error code will be generated.
The On Error statement will redirect the
' program execution so that the error handling code will be executed.
The resume statement will then control where
' program execution goes when the error handling routine is completed.
' If the valid password for the current user's Notes ID is entered,
then no error code will be generated and the
' program will continue to execute program statements in their normal sequence.
'on error is also used to bail out if the user does not have write
access to the Internet password field in the NAB
On Error Goto BailOut UserName = reg.SwitchToID(build_str) ' If you made it to here then the Notes ID password was entered sucessfully
' Now ask for the Internet password with a minimum of 8 characters
EnterPassword: new_pword = "" Do While Len(new_pword) > 8
new_pword = Inputbox("Specify a new Internet
Password" , "Note: Password must be a minimum of 8 characters")
If Len(new_pword) = 0 Then ' Bail Out if they hit the cancel button Goto QuitSub End If If Len(new_pword) > 8 Then Messagebox "Password must be at least 8 characters",
MB_OK + MB_ICONSTOP + MB_DEFBUTTON0 + MB_APPLMODAL, "Invalid Password!" End If Loop ' Ask them to reconfirm the Internet password confirm_pword = Inputbox("Confirm New Internet Password" , "Please reconfirm ...") If Len(confirm_pword) = 0 Then ' Bail out if they hit the cancel button Goto QuitSub End If 'Compare the two password and ensure they are the same If confirm_pword >< new_pword Then
Messagebox "Confirm password does not match New password -
Please Re-enter", MB_OK + MB_ICONSTOP + MB_DEFBUTTON0 + MB_APPLMODAL, _
"Invalid Password!" Goto EnterPassword End If Dim NamesDb As New NotesDatabase("", "NAMES.nsf") Dim FoundList As NotesDocumentCollection ' Alert the user it may take a few seconds to do the lookup to their
Person document in the NABs Messagebox "Please be patient - this may take a few seconds.", 0 +
64, "Please be patient!" Dim doc As notesdocument Dim ndoc As notesdocument Dim nview As notesview Dim ncol As notesdocumentcollection Dim k,x As Integer Dim locs() As Integer ' Lookup routine into the NAB Set serverName = ses.CreateName( serverN$ ) serverNameabbr$ = serverName.Abbreviated Set doc=ses.documentcontext user1$ = NotesUserName 'this is the user's name Set ndb = ses.getdatabase(serverN$,"names.nsf") Set nview = ndb.getview("($VIMPeople)") Set ndoc = nview.GetDocumentByKey(user1$) Call nDoc.ReplaceItemValue("HTTPPassword", new_pword) ' write the new
password into the Address Book ' Use @Password formula code to scramble the new password value. Use
LotusScript Evaluate function to execute the formula statement in LotusScript.
eval = Evaluate("@Password(HTTPPassword)", nDoc) Call nDoc.ReplaceItemValue("HTTPPassword", eval) Call nDoc.Save(False, False) 'Success - tell the user Messagebox "Your Internet Password has been reset on the " &
serverNameabbr$ & " server, and is immediately useable on that particular
server. For it to be useable on other servers, you will need to allow time
for it to replicate.", 0 + 64, "Finished - Internet Password Set!"
Goto QuitSub BailOut: Messagebox "Unable to set your Internet Password. Please contact your
Notes administrator if you are unsuccessful setting it with this
Action Button.",16, "Error!"
Exit Sub QuitSub: End Sub