Sub Initialize
Dim session As New NotesSession
Dim ThisDB As NotesDatabase, DirectoryDB As NotesDatabase
Dim UserView As NotesView
Dim ThisDoc As NotesDocument, UserDoc As NotesDocument
Dim UserName As NotesName
Dim Adminp As NotesAdministrationProcess
Dim sUserName As String
sUserName = session.EffectiveUserName
Set UserName = New NotesName(sUserName)
Set ThisDB = session.CurrentDatabase
Set ThisDoc = session.DocumentContext
Set DirectoryDB = New NotesDatabase("", "names.nsf")
Set Adminp = session.CreateAdministrationProcess(ThisDB.Server)
If DirectoryDB.IsOpen Then
Set UserView = DirectoryDB.GetView("($Users)")
If Not UserView Is Nothing Then
Set UserDoc = UserView.GetDocumentByKey(sUserName, True)
If Not UserDoc Is Nothing Then
If session.VerifyPassword(ThisDoc.Password(0), UserDoc.HTTPPassword(0)) Then
If ThisDoc.PasswordNew(0) <> ThisDoc.PasswordConfirm(0) Then
Print "location:/"+ThisDB.FilePath+"/pwChange?openform&reasonType=5"
Else
If Len(ThisDoc.PasswordNew(0)) < 6 Then
Print "New password not long enough"
Else
If ThisDoc.PasswordNew(0) Like "*[A-z]*" And ThisDoc.PasswordNew(0) Like "*#*" Then
Call Adminp.ChangeHTTPPassword( UserName.Canonical , ThisDoc.Password(0) , ThisDoc.PasswordNew(0) )
Print "location:/"+ThisDB.FilePath+"/pwChanged?openform"
Else
Print "location:/"+ThisDB.FilePath+"/pwChange?openform&reasonType=15"
End If
End If
End If
Else
Print "Wrong password entered"
End If
Else
Print "Can't open user document"
End If
Else
Print "Can't open nab view"
End If
Else
Print "Can't open nab"
End If
End Sub