前面我们介绍了,如果介绍了,通过代码实现域密码修改流程,今天我们主要介绍如何实现web方式重置域密码,该功能主要面向管理员;同时挂载邮箱密码重置功能链接,实现,通过web方式重置域密码后,Domino邮箱密码也随之重置达到统一的效果;
主要做法就是在域密码修改及遗忘流程功能下修改代码实现重置密码效果:
添加图示并且添加重置密码代码:
可以复制其他试图及修改代码即可;
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"
/> <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
}
}
|
重置域密码后,需要重置Domino密码:所以需要添加关联domino下web方式重置密码的URL
web下方式重置domino密码
然后,重新生成解决方案及发布:
发布后,可通过iis访问浏览
通过添加网站方式,选择发布后的路径文件
添加后,修改应用程序池的版本;默认是net2.0,需要修改net4.0
浏览访问
接下来测试一下
重置user1的密码为123123
通过user01及重置后的密码尝试验证登陆
接下来测试domino密码是否也被重置:
本文转自 高文龙 51CTO博客,原文链接:http://blog.51cto.com/gaowenlong/1346887,如需转载请自行联系原作者