一、B/S下用户的登陆界面制作问题
1、在服务器设置中Internet协议->Domino Web引擎->HTTP会话->会话验证选择为单服务器或多服务器,然后在服务器控制台内键入: tell http restart (重启HTTP服务)。
2、用服务器端高级模板domcfg5.ntf,也就是Domino Web 服务器配置数据库模板,在/domino/data/ 目录下新建数据库:domcfg.nsf 。
3、用notes打开新建好的domcfg.nsf数据库,点击“登陆表单映射”视图,再从菜单中选择“创建”-->“映射登陆表单”,在里面添上目标数据库文件名,即domcfg.nsf,和目标表单名:CustomLoginForm,保存并关闭文档。
4、用designer打开domcfg.nsf数据库,创建名称为CustomLoginForm的表单,那么,当web服务器要求浏览器用户提供名字和口令时,便会显示该表单。如果你没有创建映射登录表单,则系统缺省显示$$LoginUserForm表单。
二、定制了自己的登录表单,那么就该开始人员注册了。
注册的步骤是什么样子的呢?,当你用admin在服务器注册人员时,做了些什么?在这里主要用到的Lotuscript类是notesregistration.
当进入注册页面,打开的数据库是names.nsf,就是通常中文翻译为通讯录的库。而人员视图默认的当然是people view.当你开始注册人员时,先要使用验证字,默认的一般是Cert.id,也要输入密码的。然后就是指定人员的姓名,密码,邮件,ID的期限等等。在lotuscript中的大致过程也是如此。见部分代码:
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 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/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