<%
On
Error
resume next
if request(
"Do"
)=
"Error"
then
Select
Case
Request(
"Type"
)
case
"Account"
%>
<html><head><title>Password Change</title></head><body><p>Bad Account</p> <p><a href=
<%
case
"Change"
%>
<html><head><title>Password Change</title></head><body><p>Can
<%
Case
"Password"
%>
<html><head><title>Password Change</title></head><body><p>Bad Password</p> <p><a href=
<%
Case
"Confirm"
%>
<html><head><title>Password Change</title></head><body><p>Password Confirmation Issue</p> <p><a href=
<%
case else
%>
<html><head><title>Password Change</title></head><body><p>Unknown
Error
</p> <p><a href=
<%
end select
response.
End
end if
if request(
"Do"
)=
"ChangePassword"
then
Dim
obApp
Set
obApp = CreateObject(
"hMailServer.Application"
)
Call
obApp.Authenticate(request(
"Email"
), request(
"OldPassword"
))
if err.number<>0 then
response.Redirect(
"?Do=Error&Type=Password"
)
response.
End
end if
Dim
obDomain
Set
obDomain = obApp.Domains.ItemByName(Split(request(
"Email"
),
"@"
)(1))
if err.number<>0 then
response.Redirect(
"?Do=Error&Type=Password"
)
response.
End
end if
if trim(Request(
"PasswordConf"
))<>
""
and Request(
"PasswordConf"
)=Request(
"Password"
)then
Dim
obAccount
Set
obAccount = obDomain.Accounts.ItemByAddress(request(
"Email"
))
if err.number<>0 then
response.Redirect(
"?Do=Error&Type=Account"
)
response.
End
end if
obAccount.Password=Request(
"Password"
)
obAccount.Save
if err.number<>0 then
response.Redirect(
"?Do=Error&Type=Change"
)
response.
End
end if
Response.Write (
"<html><head><title>Password Changed</title></head><body><p>Password Changed</p> <p><a href='?' >Back</a></p></body></html>"
)
Response.
End
()
else
response.Redirect(
"?Do=Error&Type=Confirm"
)
response.
End
end if
end if
%>
<!DOCTYPE html>
<html>
<head>
<title>Change Password </title>
<style type=
"text/css"
>
/*************************************************/
/*By Babak */
.SimpleTable
{
padding-left: auto;
padding-right: auto;
margin-left: auto;
margin-right: auto;
border: solid thin black;
border-collapse: collapse;
}
.SimpleTable th, .SimpleTable thead
{
font-size: 14px;
background-color: #882222;
color: #AAAA22;
}
.SimpleTable th, .SimpleTable td
{
text-align: center;
border: solid thin black;
padding: 1px 10px 1px 10px;
margin: 0px 0px 0px 0px;
}</style>
</head>
<body>
<form action=
"?Do=ChangePassword"
method=
"post"
>
<table class=SimpleTable>
<tr>
<th colspan=
"2"
>
Change Password
</th>
</tr>
<tr>
<th>
Email
</th>
<td>
<input name=
"Email"
type=
"Email"
/>
</td>
</tr>
<tr>
<th>
Old Password
</th>
<td>
<input name=
"OldPassword"
type=
"password"
/>
</td>
</tr>
<tr>
<th>
New
Password
</th>
<td>
<input name=
"Password"
type=
"password"
/>
</td>
</tr>
<tr>
<th>
New
Password (Confirm)
</th>
<td>
<input name=
"PasswordConf"
type=
"password"
/>
</td>
</tr>
<tr>
<td colspan=
"2"
>
<input type=
"submit"
/>
</td>
</tr>
</table>
</form>
</body>
</html>