|
|
Sub Initialize Dim session As New NotesSession Dim Curdb As NotesDatabase Dim Curdoc As NotesDocument Dim Tempdoc As NotesDocument Dim Namedb As NotesDatabase Dim NewDoc As NotesDocument Dim PeopleView As NotesView ' Dim View As NotesView Dim newreg As New notesregistration Dim success,saveok As Variant Set Curdb = session.CurrentDatabase Set Curdoc = session.DocumentContext Set Namedb = New NotesDatabase( "","names.nsf" ) Set PeopleView = Namedb.GetView("People") PeopleView.AutoUpdate = True Set Tempdoc = PeopleView.GetDocumentByKey( Curdoc.CurrUserName(0),True ) If Not( Tempdoc Is Nothing ) Then '用户已存在 Print "<BODY TEXT='000000' BGCOLOR='#F5F0E6' " Print "<form><B><center><FONT SIZE=5 COLOR='ff0000' FACE='楷体_GB2312'>" Print "<br><br><br><br><br><br><br>NO!NO!<font size=6 color='00ff00'>"+"</font><br>--用户已存在!<br>" Print "<BR> <BR><INPUT TYPE=button onClick='history.go(-1)' VALUE='返 回'>" Print "<FONT FACE='仿宋_GB2312'></center></FONT></form>" Else '注册用户 Dim db As notesdatabase Set db = session.currentdatabase Dim certidfile As String, org As String, _ certpw As String org = "TestOrg" length% = 2 certidfile = "D:\Lotus\Domino\Data\pwoa\Cert.id" certpw = "q1w2e3r4t5" 'newreg.RegistrationLog = "certlog.nsf" newreg.IDType = ID_HIERARCHICAL newreg.Expiration = Datevalue("December 31, 2100") newreg.MinPasswordLength = length% newreg.IsNorthAmerican = True newreg.CertifierIDFile = certidfile newreg.RegistrationServer = db.Server 'newreg.OrgUnit = org newreg.CreateMailDb = True newreg.StoreIDInAddressBook = True newreg.Updateaddressbook = False MailFile = "Mail\"&Curdoc.CurrUserName(0)&".nsf" Firstname = "" Lastname = Curdoc.CurrUserName(0) RegServer = db.Server comment = "Comment contents" IDfile = "D:\Lotus\Domino\Data\pwoa\ids\"&Curdoc.CurrUserName(0)&".id" userPassword=Curdoc.userpass(0) middleinit = "" location = "office" Call newreg.RegisterNewUser( Lastname, IDfile, _ RegServer, Firstname, middleinit, certpw, _ location, comment, MailFile, "", userPassword, _ NOTES_FULL_CLIENT ) Call newreg.AddUserToAddressbook(IDfile, _ Firstname & " " & Lastname, Lastname, userPassword, _ Firstname, middleinit, RegServer, MailFile, _ fwdaddress, location, comment ) Call PeopleView.Refresh Set PeopleView = Namedb.GetView("People") Set Tempdoc = PeopleView.GetDocumentByKey( Curdoc.CurrUserName(0),True ) If Not( Tempdoc Is Nothing ) Then '用户存在 TempDOC.HTTPPassword = CurDOC.userpass(0) TempDOC.InternetAddress=Curdoc.CurrUserName(0)&"@ddec.com.cn" success = TempDOC.ComputeWithForm(True,False) If success Then' saveok = TempDOC.save(True,True) End If End If Print "<BODY TEXT='000000' BGCOLOR='#F5F0E6' " Print "<form><B><center><FONT SIZE=5 COLOR='ff0000' FACE='楷体_GB2312'>" Print "<br><br><br><br><br><br><br>OK!OK!<font size=6 color='000000'>"+Curdoc.CurrUserName(0)+"</font>已经注册成功!<br>" Print "口令为 :<font size=5 color='000000'>"+CurDOC.userpass(0)+"</font>,请尽快通知!</FONT></B><BR> <BR><INPUT TYPE=button onClick='history.go(-2)' VALUE='返 回'>" Print "<FONT FACE='仿宋_GB2312'></center></FONT></form>" End If End Sub
|
|