通过代码实现web方式重置域密码及同步Domino密码

简介:

前面我们介绍了,如果介绍了,通过代码实现域密码修改流程,今天我们主要介绍如何实现web方式重置域密码,该功能主要面向管理员;同时挂载邮箱密码重置功能链接,实现,通过web方式重置域密码后,Domino邮箱密码也随之重置达到统一的效果;

主要做法就是在域密码修改及遗忘流程功能下修改代码实现重置密码效果:

添加图示并且添加重置密码代码:

可以复制其他试图及修改代码即可;

clip_image002

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
@{
ViewBag.Title =  "Resetpwd" ;
Layout =  "~/Views/Shared/_LayoutView.cshtml" ;
}
@section head{
<script src= "@System.Security.Policy.Url.Content(" ~/Scripts/home.js ")"  type= "text/javascript" ></script>
}
< div  id= "contactArea" >
</ div >
< div  class = "pcontent" >
< div  class = "pstep02" >
<b>重置密码</b>
</ div >
< div  class = "pstep03" >
Change your password
</ div >
< div  class = "pstep04" >
A strong password helps prevent
</ div >
<ul  class = "ulstep" >
<li><b>Iiosoft Account</b> <a style= "cursor: pointer;"  id= "Search" >What's  this ?</li>
<li>
<input name= ""  id= "itcode"  type= "text"  class = "a01input"  />
</li>
<li  class = "liTOP" ><b>New password </b></li>
<li>
<input name= ""  id= "newpwd"  type= "password"  class = "a01input"  />
</li>
<li style= "color: #999;" >8-character minimum;  case  sensitive </li>
<li  class = "liTOP" ><b>Reenter password </b></li>
<li>
<input name= ""  id= "rtpwd"  type= "password"  class = "a01input"  />
</li>
</ul>
< div  class = "topw" >
<input type= "button"  id= "UserSetpwd"  value= "Save"  class = "btnSave"  />&nbsp;&nbsp;&nbsp;&nbsp;<input type= "button"  id= "UserpwdCancel"  value= "Cancel"  class = "btnCancel"  />
</ div >
< div  id= "Loading3"  style= "display: none" >
<img src= "../img/grid-loading.gif"  /><span id= "sProcess3" >更新密码中,请稍后...</span>
</ div >
</ div >
然后修改homecontroller.cs
添加一下代码:
public  void  ChangePwd()
{
string sItCode = Request[ "sItCode" ];
string sOldPwd = Request[ "sOldPwd" ];
string sNewPwd = Request[ "sNewPwd" ];
ADOperator ao =  new  ADOperator();
int  y = ao.IsUserExistsByAccount(sItCode);
string Rs =  "" ;
if  (y == 1)
{
int  x = ao.Login(sItCode, sOldPwd);
if  (x == 1)
{
int  z = ao.ChangeUserPassword(sItCode, sOldPwd, sNewPwd);
if  (z == 1)
{
Rs =  "CS" ;
//调用Domino密码修改
changeDominoPwd(sItCode, sNewPwd);
}
else
{
Rs =  "TR" ;
}
}
else
{
Rs =  "EP" ;
}
}
else
{
Rs =  "NU" ;
}
ao.dispose();
Response.Write(Rs.ToString());
}
//重置密码
//[HttpGet]
public  void  SetPassword()
{
string Rs =  "CS" ;
string sItCode = Request[ "sItCode" ];
string sOldPwd = Request[ "sOldPwd" ];
string sNewPwd = Request[ "sNewPwd" ];
ADOperator ao =  new  ADOperator();
int  y = ao.IsUserExistsByAccount(sItCode);
if  (y == 1)
{
ADOperator.SetPasswordByAccount(sItCode, sNewPwd);
changeDominoPwd(sItCode, sNewPwd);
Response.Write(Rs.ToString());
}
}
#region Domino密码同步修改
public  static  void  changeDominoPwd(String sNewUserName, String sNewPwd)
{
String serverName =  "iio-mail01" ;
String cookie =  "%temp%/cookie.txt" ;
String system_username =  "changepwd" ;
String system_passwd =  "password8" ;
String str_login =  "cmd.exe /c curl -c "  + cookie +  " -d \"%25%25ModDate=0FF5136000000000&Username="  + system_username +  "&Password="  + system_passwd +  "&RedirectTo=%2FChgUpwd.nsf%2Finternetpwd%3FOpenForm\" \"http://" +serverName+ "/names.nsf?Login\" " ;
String str_changepwd =  "cmd.exe /c curl -b "  + cookie +  " -d \"__Click=0&Form=internetpwd&Time=2013-12-18+19%3A47%3A48&CurLoginUser=CN%3D"  + system_username +  "%2FO%3Diiosoft&UserName="  + sNewUserName +  "&UserPassword="  + sNewPwd +  "\" \"http://" +serverName+ "/ChgUpwd.nsf/internetpwd?OpenForm&Seq=1\"" ;
Win32_Process win32 =  new  Win32_Process();
win32.CreateProcess(str_login);
win32.CreateProcess(str_changepwd);
}
#endregion
}
}

clip_image004

重置域密码后,需要重置Domino密码:所以需要添加关联domino下web方式重置密码的URL

clip_image006

web下方式重置domino密码

clip_image008

然后,重新生成解决方案及发布:

clip_image010

发布后,可通过iis访问浏览

clip_image012

clip_image014

clip_image016

通过添加网站方式,选择发布后的路径文件

clip_image018

添加后,修改应用程序池的版本;默认是net2.0,需要修改net4.0

clip_image020

浏览访问

clip_image022

clip_image024

接下来测试一下

重置user1的密码为123123

clip_image026

通过user01及重置后的密码尝试验证登陆

clip_image028

clip_image030

接下来测试domino密码是否也被重置:

clip_image032



本文转自 高文龙 51CTO博客,原文链接:http://blog.51cto.com/gaowenlong/1346887,如需转载请自行联系原作者

相关文章
|
2月前
|
Web App开发
Star 5.5k!这款Web剪藏工具绝了,支持10+平台内容剪辑同步!
Star 5.5k!这款Web剪藏工具绝了,支持10+平台内容剪辑同步!
|
6月前
|
数据采集 JavaScript 前端开发
超越React,JS代码体积减少90%!它为何是2023年最好的Web框架?
超越React,JS代码体积减少90%!它为何是2023年最好的Web框架?
|
10月前
|
移动开发 JavaScript 前端开发
扛着锄头写代码之vuejs和nodejs搞起web app系列
上次为了vue.js实现web app看的nodejs,首先感谢上次各位大神对nodejs初识不足的指点。本次烟纠了个小小的Demo,来总结和提疑。
73 0
扛着锄头写代码之vuejs和nodejs搞起web app系列
|
11月前
|
监控 安全 测试技术
用 Python 撸一个 Web 服务器-第7章:重构——更好的组织代码
用 Python 撸一个 Web 服务器-第7章:重构——更好的组织代码
|
12月前
|
安全 Linux Windows
WEB漏洞-RCE代码及命令执行漏洞
WEB漏洞-RCE代码及命令执行漏洞
|
测试技术
对个人博客系统进行web自动化测试(包含测试代码和测试的详细过程)(下)
对个人博客系统进行web自动化测试(包含测试代码和测试的详细过程)(下)
127 0
|
前端开发 Java 测试技术
对个人博客系统进行web自动化测试(包含测试代码和测试的详细过程)(上)
对个人博客系统进行web自动化测试(包含测试代码和测试的详细过程)(上)
197 0
|
前端开发 安全 JavaScript
【web渗透思路】任意账号的注册、登录、重置、查看
【web渗透思路】任意账号的注册、登录、重置、查看
549 0
【web渗透思路】任意账号的注册、登录、重置、查看
|
安全 前端开发 Java
JAVA WEB之XSS防御工具类代码示例
JAVA WEB之XSS防御工具类代码示例
230 0
JAVA WEB之XSS防御工具类代码示例
|
测试技术 iOS开发
Flutter Web网站之最简方式实现暗黑主题无缝切换
Flutter Web网站之最简方式实现暗黑主题无缝切换
270 0
Flutter Web网站之最简方式实现暗黑主题无缝切换