Domino9下通过web方式批量重置邮箱密码
近期呢,公司有一个分布将近有700左右的人员,均需要重置一下一邮箱密码,重置密码简单,可人数众多,如果管理员通过手动的方式一个一个重置会给管理员带来很大困扰,同时密码要求重置成不不同的密码,如果将所有用户密码重置成一个密码就方便很多,所以就想到了通过web程序来实现批量重置邮箱密码,做完后,效果还不错,再此分享给大家,供参考学习。
密码重置要求是用户名+***后6位;通过web方式重置用户密码的格式要求是:用户名,密码的方式
我们首先在notes下创建一个空数据库
为数据库命名:Changepwd.nsf
创建好后,我们通过desinger打开该数据库
因为我们开始已经定义了web的排版页面,所以首先是创建一个表单
表单名称:pwd
设置自己的页面格式:具体参考见下:
<div style="display:none"> </div> <div style="text-align:center"> <h1>邮箱密码重置系统<h1> </div> <table border="1" cellspacing="0" align="center" style=";text-align:center"> <tr> <td>Tip</td> <td>请按照以下格式进行填写:username,password</td> </tr> <tr> <td>用户名+密码:</td> <td></td> </tr> <tr> <td colspan="2" align="center"> </td> </tr> </table>
将代码写好后,我们保存
用户名域值属性---文本、多值
输入的参数通过新行来区分
调整页面大小
添加一个重置按钮
重置密码的表单已经完成。
重置密码程序:---新建代理agtpwd
编辑程序
%REM Agent 修改用户名密码 Created 2013-12-15 by administrator/iiosoft Description: Comments for Agent %END REM Option Public Option Declare Dim session As NotesSession Dim db As NotesDatabase Dim doc As NotesDocument Dim namesdb As NotesDatabase Dim namesdoc As NotesDocument Dim namesview As NotesView Sub Initialize On Error GoTo err_handle Dim flag As Boolean Dim mstring As String Dim arr As Variant Set session = New NotesSession Set db = session.Currentdatabase Set doc = session.Documentcontext Set namesdb = New NotesDatabase("","names.nsf") flag = False If Not namesdb.Isopen Then MsgBox "您无权限修改,请联系管理员" Print |<script type=‘text/javascript‘> alert("您无权限修改,请联系管理员""); window.location = "http://iio-mail01.iiosoft.com/ChgUpwd.nsf/|+doc.Form(0)+|?OpenForm"; </script>| Exit sub End If Set namesview = namesdb.Getview("People") ForAll msg In doc.username Call fnChangeUserPwd(msg) End ForAll Print |<a href ="/| & doc.dbpath(0) & |/pwd?openform">click here To Return | Exit Sub err_handle: MsgBox session.Currentdatabase.Filepath + session.Currentagent.name MsgBox Error MsgBox Erl End Sub %REM Sub fnChangeUserPwd Description: Comments for Sub %END REM Sub fnChangeUserPwd(msg As String) On Error GoTo eh Dim namedoc As NotesDocument Dim user As String Dim pwd As String If msg="" Then Exit sub End If user=StrLeft(msg,",") pwd=StrRight(msg,",") Set namedoc=namesview.Getdocumentbykey(user, true) If Not namedoc Is Nothing Then namedoc.HTTPPassword = Evaluate(|@Password("| & pwd &|")|) namedoc. HTTPPasswordChangeDate = Now Call namedoc.save(True,True) Print "change user : " & user & " password :" & pwd & " ,Rest success <br>" Else Print "can not find user: " & user & "<br>" End If Exit Sub eh: MsgBox Error & " " & erl End Sub
%REM Agent 修改用户名密码 Created 2013-12-15 by administrator/iiosoft Description: Comments for Agent %END REM Option Public Option Declare
Dim session As NotesSession Dim db As NotesDatabase Dim doc As NotesDocument Dim namesdb As NotesDatabase Dim namesdoc As NotesDocument Dim namesview As NotesView
Sub Initialize On Error GoTo err_handle Dim flag As Boolean Dim mstring As String Dim arr As Variant Set session = New NotesSession Set db = session.Currentdatabase Set doc = session.Documentcontext Set namesdb = New NotesDatabase("","names.nsf") flag = False If Not namesdb.Isopen Then MsgBox "您无权限修改,请联系管理员" Print |<script type=‘text/javascript‘> alert("您无权限修改,请联系管理员""); window.location = "http://iio-mail01.iiosoft.com/ChgUpwd.nsf/|+doc.Form(0)+|?OpenForm"; </script>| Exit sub End If Set namesview = namesdb.Getview("People") ForAll msg In doc.username Call fnChangeUserPwd(msg) End ForAll Print |<a href ="/| & doc.dbpath(0) & |/pwd?openform">click here To Return | Exit Sub err_handle: MsgBox session.Currentdatabase.Filepath + session.Currentagent.name MsgBox Error MsgBox Erl End Sub
%REM Sub fnChangeUserPwd Description: Comments for Sub %END REM Sub fnChangeUserPwd(msg As String) On Error GoTo eh Dim namedoc As NotesDocument Dim user As String Dim pwd As String If msg="" Then Exit sub End If user=StrLeft(msg,",") pwd=StrRight(msg,",") Set namedoc=namesview.Getdocumentbykey(user, true) If Not namedoc Is Nothing Then namedoc.HTTPPassword = Evaluate(|@Password("| & pwd &|")|) namedoc. HTTPPasswordChangeDate = Now Call namedoc.save(True,True) Print "change user : " & user & " password :" & pwd & " ,Rest success <br>" Else Print "can not find user: " & user & "<br>" End If Exit Sub eh: MsgBox Error & " " & erl End Sub
代码标记好后,我们需要通过表单来调用程序
查看服务器信息
输入需要重置的用户及密码进行重置密码
重置完成后,我们可以看见操作的log
重置后,还可以单击跳转页面进行跳转到密码重置首页
重置后,我们通过控制台来验证密码是否重置成功
注:数据库上传到页面上了,下载附件后,将扩展名更改为.7z后才能解压。
本文出自 “高文龙” 博客,请务必保留此出处http://gaowenlong.blog.51cto.com/451336/1561185
原文地址:http://gaowenlong.blog.51cto.com/451336/1561185