域密码自助重置系统----绑定私人邮箱信息自助重置(一)

作为一个企业管理员来说,最头疼的事就是用户密码重置工作了;也许跟公司的性质有很大关系,就拿我们公司来说吧!我们企业内部有90%的用户属于外派人员,这些外派人员来说很少有机会访问公司内部资源,所以这些用户的密码容易忘记。由于企业内部的用户账户信息设置最长使用周期是180天,如果在180天没有修改密码,密码将会过期;最主要的是公司内部使用erp系统,用户每个月都要使用自己的用户信息去填写erp,如果不及时填写的话就没有考勤,这样的结果大家都很明白了。当每个月填写考勤的日期,it部门会好几百封邮件做密码重置的;这样给管理员带来太多问题,为了解决这个问题,前面文章有介绍通过web方式批量重置用户的密码,但是这个对于管理员来说是操作方便了,但是解决不了用户的问题,用户的问题就是不更改密码,就是忘记密码后发邮件给it部门让做重置,这样的员工太多了。所以就想通过用户密码自助重置系统来降低管理员的日常工作。

用户通过有效的用户信息登录系统内部,绑定自定义信息后,可以通过绑定的信息自助重置密码。

一、首先是创建安装数据库SQL Server2008,同时创建数据库及表单,在此忽略;

2.创建DBconnection表单,填写数据库的字段信息

using System;
using System.Data;
using System.Data.Odbc;
using System.Web;
using System.Configuration;
using System.Data.SqlClient;
using System.Text;
namespace ChangePassword.Models
{
/// <summary>
/// DataBase Connection Class.
/// </summary>
public class DbConn
{
// Create a database Connection. using here Access Database
// Return type object of OdbcConnection
public OdbcConnection connection;
public OdbcDataReader ReadData;
public OdbcCommand aCommand;
public static string DBConnectionName { get; set; }
public static string DataBaseName { get; set; }
public DbConn()
{
string ConnectionString = ConfigurationManager.AppSettings["dbconnection"].ToString();
try
{
// create connection object
connection = new OdbcConnection();
// set connection string
connection.ConnectionString = ConnectionString;
// open connection
connection.Open();
// get reader
}
catch (Exception e)
{
HttpContext.Current.Response.Write(e.Message.ToString());
}
}
public void ExecuteQuery(string sql)
{
aCommand = new OdbcCommand(sql, connection);
aCommand.ExecuteNonQuery();
}
public DbConn(string strQuery)
{
string ConnectionString = ConfigurationManager.AppSettings["dbconnection"].ToString();
try
{
// create connection object
connection = new OdbcConnection();
// set connection string
connection.ConnectionString = ConnectionString;
// open connection
connection.Open();
// get reader
GetReader(strQuery);
}
catch (Exception e)
{
HttpContext.Current.Response.Write(e.Message.ToString());
}
}
public DbConn(string strQuery,string dbName)
{
// MS Access DataBase Connection - Defined in Web.Config
string connectionName = dbName;//"MSAccessConnectionTD";//"MSAccessConnection";
// SQL Server DataBase Connection - Defined in Web.Config
//string connectionName = "SQLServerConnection";
// Creating Connection string using web.config connection string
string ConnectionString = ConfigurationManager.ConnectionStrings[connectionName].ConnectionString;
try
{
// create connection object
connection = new OdbcConnection();
// set connection string
connection.ConnectionString = ConnectionString;
// open connection
connection.Open();
// get reader
GetReader(strQuery);
}
catch (Exception e)
{
HttpContext.Current.Response.Write(e.Message.ToString());
}
}
// Create an instance dataReader
// Return type object of OdbcDataReader
/// <summary>
/// Get Data Reader
/// </summary>
/// <param name="strQuery">SQL Query</param>
public void GetReader(string strQuery)
{
// Create a Command object
aCommand = new OdbcCommand(strQuery, connection);
// Create data reader object using strQuery string
// Auto close connection
ReadData = aCommand.ExecuteReader(CommandBehavior.CloseConnection);
}
}
}

Web.conf配置数据库连接

新建验证用户信息表单

#region ChangePwdApplyFor绑定邮箱设置
/// <summary>
/// 绑定邮箱设置
/// </summary>
/// <param name="sname">员工姓名</param>
/// <param name="sitCode">员工编号</param>
/// <param name="personalemail">个人邮箱</param>
/// <returns></returns>
public JsonResult ChangePwdApplyFor(string sname, string sitCode, string personalemail)
{
string Rs = "";
// 1.验证所填信息
if (string.IsNullOrEmpty(sname) || string.IsNullOrEmpty(sitCode))
{
Rs = "name and itcode and employee number not be null";
}
else
{
// 2.发送邮件到邮箱
Random random = new Random();
string randomCode = random.Next(10000, 99999).ToString();
HttpContext.Cache.Insert(sitCode + "_bind", randomCode, null, DateTime.Now.AddMinutes(30), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.High, null);
HttpContext.Cache.Insert(sitCode + "_PrivateEmail", personalemail, null, DateTime.Now.AddMinutes(30), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.High, null);
Mails m = new Mails();
bool s = m.SendMail(personalemail, sitCode, randomCode, false);
if (s)
{
Rs = "S";
}
else
{
Rs = "F";
}
}
return Json(Rs);
}
#endregion
#region GetItcode根据员工编号获得员工姓名
/// <summary>
///
/// </summary>
public void GetItcode()
{
string sUserId = Request["sUserId"];
Users u = new Users();
string itcode = u.GetUserItcode(sUserId);
Response.Write(itcode.ToString());
}
#endregion
#region GetItcode根据员工编号获得员工姓名
/// <summary>
/// 根据员工编号获得员工姓名
/// </summary>
/// <param name="sUserId">员工编号</param>
/// <returns></returns>
public string GetItcode(string sUserId)
{
Users u = new Users();
string itcode = u.GetUserItcode(sUserId);
if (itcode!=null)
{
Session["sUserId"] = sUserId;
Session["itcode"] = itcode;
}
return itcode.ToString();
}
#endregion
#region BindEmail绑定邮箱并把绑定的邮箱插入数据库
/// <summary>
/// 绑定邮箱并把绑定的邮箱插入数据库
/// </summary>
/// <returns></returns>
public ActionResult BindEmail()
{
string Rs = "";
string sUserEmail = Request["bindemail"];
string sUserId = Request["idcode"];//员工编号
string sItcode = GetItcode(sUserId);
string sverificationCode = Request["code"];//员工姓名
string privateEmail = (string)HttpContext.Cache[sUserId + "_PrivateEmail"];//5930_PrivateEmail
string verificationCode = (string)HttpContext.Cache[sUserId + "_bind"];//5930_bind
if (string.IsNullOrEmpty(verificationCode) || sverificationCode.Trim() != verificationCode)
{
Rs = "Verification code have failed";
return RedirectToAction("ApplySuccess", new { type = 0 });
}
else if (isBindEmail(sUserEmail, sUserId))
{
Rs = "user has been bind";
return RedirectToAction("ApplySuccess", new { type = 3 });
}
else
{
string sql = "insert into userbind values(1,'" + sUserId + "','" + sItcode + "','" + sUserEmail + "','1');";
DbConn conn = new DbConn();
conn.ExecuteQuery(sql);
Rs = "Y";
HttpContext.Cache.Remove(sUserId + "_PrivateEmail");
HttpContext.Cache.Remove(sUserId + "_bind");
return RedirectToAction("ApplySuccess",new {type=4});
}
}
#endregion
#region SendFgEmail判断用户是否已经绑定邮箱
/// <summary>
/// 判断用户是否已经绑定邮箱
/// </summary>
/// <returns></returns>
public JsonResult SendFgEmail() //string sUserEmail,string sUserId
{
string sUserEmail = Request["sUserEmail"];
string sUserId = Request["sItcode"]; //员工编号
string Rs = "";
string sItcode = GetItcode(sUserId);//员工姓名
Mails m = new Mails();
bool isbind = isBindEmail(sUserEmail, sUserId);
if (isbind)
{
Random random = new Random();
string randomCode = random.Next(10000, 99999).ToString();
Session["bindeamil"] = sUserEmail;
HttpContext.Cache.Insert(sItcode+"_code", randomCode, null, DateTime.Now.AddMinutes(30), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.High, null);
HttpContext.Cache.Insert(sItcode + "_reset_uid", sUserId, null, DateTime.Now.AddMinutes(30), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.High, null);
HttpContext.Cache.Insert(sItcode + "_reset_uname", sItcode, null, DateTime.Now.AddMinutes(30), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.High, null);
HttpContext.Cache.Insert(sItcode + "_PrivateEmail", sUserEmail, null, DateTime.Now.AddMinutes(30), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.High, null);
if (getBindEmail(sItcode).Trim().Equals(sUserEmail.Trim()))
{
Rs = "B";//绑定
bool s = m.SendMail(sUserEmail, sUserId, randomCode, isbind);
}
else
{
Rs = "N"; //邮箱不匹配
}
}
else
{
Rs = "S"; //未绑定
}
return Json(Rs);
}
#endregion
#region getBindEmail根据员工编号获得绑定的邮箱
/// <summary>
/// 根据员工编号获得绑定的邮箱
/// </summary>
/// <param name="sItcode">员工编号</param>//5930
/// <returns></returns>
public string getBindEmail(string sItcode)
{
string bindemail = String.Empty;
string sql = "select bindemail from userbind where username='" + sItcode + "' and isbind=1";
DbConn oRsStatusCount = new DbConn(sql);
while (oRsStatusCount.ReadData.Read())
{
bindemail = oRsStatusCount.ReadData["bindemail"].ToString().Trim();
}
return bindemail;
}
#endregion
#region isBindEmail根据传入的员工编号或邮箱判断是否已经绑定邮箱
/// <summary>
/// 根据传入的员工编号或邮箱判断是否已经绑定邮箱
/// </summary>
/// <param name="sUserEmail">绑定的邮箱</param>
/// <param name="sItcode">员工编号</param>
/// <returns></returns>
public Boolean isBindEmail(string sUserEmail, string sItcode)
{
bool bindflag = false;
string username = GetItcode(sItcode);//员工姓名
string sql = "select count(1) as co from userbind where userid=" + sItcode + " and username='" + username + "' and isbind=1";
DbConn oRsStatusCount = new DbConn(sql);
while (oRsStatusCount.ReadData.Read())
{
int count =(int)(oRsStatusCount.ReadData["co"]);
if (count>0)
{
bindflag = true;
break;
}
else
{
bindflag = false;
}
}
return bindflag;
}
#endregion
#region ChangePwd修改密码
/// <summary>
/// 修改密码
/// </summary>
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());
}
#endregion
#region LoginAutheration管理员登陆时判断
/// <summary>
/// 管理员登陆时判断
/// </summary>
public void LoginAutheration()
{
string Rs = "";
string username = Request["username"];
string password = Request["password"];
if (ADOperator.adminlist!=null && ADOperator.adminlist.Contains(username))
{
try
{
DirectoryEntry de = ADOperator.GetDirectoryObject(@iiosoft\" + username, password);
if (de.Name != null)
{
// DirectoryEntry de = ADHelper.GetDirectoryObject(username, password);
//SetPasswordByAccount(de, "user01", "123456abc");
///changeDominoPwd("user01", "123456abc");
Session["admin"] = de;
Rs = "SU";
}
}
catch (Exception)
{
Rs = "CS";
}
}
else
{
Rs = "FA";
}
Response.Write(Rs.ToString());
}
#endregion
#region SetPassword重置密码
/// <summary>
/// 重置密码
/// </summary>
public void SetPassword()
{
string Rs = "";
string sItCode = Request["sItCode"].Trim();
string sNewPwd = Request["sNewPwd"];
string sverificationCode=Request["code"];
string privateEmail = (string)HttpContext.Cache[sItCode + "_PrivateEmail"];
string verificationCode = (string)HttpContext.Cache[sItCode+"_code"];
string uid = (string)HttpContext.Cache[sItCode+"_reset_uid"];
string uname = (string)HttpContext.Cache[sItCode + "_reset_uname"];
if (string.IsNullOrEmpty(verificationCode) || sverificationCode.Trim() != verificationCode.Trim() || !uname.Trim().Equals(sItCode))
{
Rs = "Verification code have failed";
}
else
{
ADOperator ao = new ADOperator();
int y = ao.IsUserExistsByAccount(sItCode);
if (y == 1)
{
string username = ConfigurationManager.AppSettings["AutoRestAdminUser"].ToString(); ;
string password = ConfigurationManager.AppSettings["AutoRestAdminPwd"].ToString(); ;
DirectoryEntry de = ADOperator.GetDirectoryObject(username, password);
//(DirectoryEntry)Session["admin"];
int z = ao.SetPasswordByAccount(de, sItCode, sNewPwd);
if (z == 1)
{
Rs = "CS";
//调用Domino密码修改
changeDominoPwd(sItCode, sNewPwd);
HttpContext.Cache.Remove(sItCode + "_PrivateEmail");
HttpContext.Cache.Remove(sItCode + "_code");
HttpContext.Cache.Remove(sItCode + "_reset_uid");
HttpContext.Cache.Remove(sItCode + "_reset_uname");
string log = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 管理员:" + de.Username.Split('\\')[1] + " 重置用户名: " + sItCode + " 重置密码: " + sNewPwd + " 绑定邮箱: " + privateEmail;
Logger.CheckLog(log);
// System.IO.File.AppendAllText("d:\\IIS2\\userlog.txt", log, Encoding.Default);
}
else
{
Rs = "FA";
}
}
else
{
Rs = "NU";
}
}
Response.Write(Rs.ToString());
}
#endregion
#region Domino密码同步修改
/// <summary>
/// Domino密码同步修改
/// </summary>
/// <param name="sNewUserName"></param>
/// <param name="sNewPwd"></param>
public static void changeDominoPwd(String sNewUserName, String sNewPwd)
{
String serverName = ConfigurationManager.AppSettings["EmailServerName"];
String system_passwd = ConfigurationManager.AppSettings["EmailSystem_passwd"];
String system_username = ConfigurationManager.AppSettings["EmailSystem_username"];
String login_domain = ConfigurationManager.AppSettings["LoginDomainName"];
String cookie = "%temp%/cookie.txt";
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%3D" + login_domain + "&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
}
}

绑定邮箱:

@{
ViewBag.Title = "PersonProfile";
Layout = "~/Views/Shared/_LayoutView.cshtml";
}
@section head{
<script src="@Url.Content("~/Scripts/person-profile.js")" type="text/javascript"></script>
}
<div class="pcontent">
<div class="pstep02">
<b>邮箱绑定</b></div>
<div class="pstep03">
Binding your private e-mail</div>
<div style="letter-spacing: 1.5px; color: #666;">
Verification code is obtained by mail</div>
<ul class="ulstep">
<li class="liTOP"><b>Employee Number</b></li>
<li>
<input id="itCode" name="" type="text" value="@ViewBag.itcode" class="a01input" readonly></li>
<li class="liTOP"><b>Iiosoft Account</b></li>
<li>
<input id="name" name="" type="text" value="@ViewBag.idcode" class="a01input" readonly></li>
<li class="liTOP"><b>Private Mail</b></li>
<li>
<input id="personalemail" name="" value="@ViewBag.bindEmail" type="text" class="a01input">
</li>
<!--li class="liTOP"><b>Department</b></!--li>
<li>
<input id="department" name="" type="text" class="a01input"></li>
<li class="liTOP"><b>Employee Number </b></li>
<!--li
<input id="employeeNumber" name="" type="text" class="a01input"></li>
<li class="liTOP"><b>Telephone</b> </li>
<li>
<input id="telephone" name="" type="text" class="a01input"></li>
<li class="liTOP"><b>Manager name</b> </li>
<li>
<input id="mamagerName" name="" type="text" class="a01input"></li>
<li class="liTOP"><b>Verification Code</b> </li>
<li>
<input id="verificationCode" name="" type="text" value="@ViewBag.Code" class="a01input" readonly></li>
<li></li-->
</ul>
<div class="topw">
<input type="button" id="UserApplyFor" value="Save" class="btnSave" />&nbsp;&nbsp;&nbsp;&nbsp;<input
type="button" id="UserCancel" value="Cancel" class="btnCancel" />
</div>
<div id="Loading3" style="display: none">
<img src="../img/grid-loading.gif" /><span id="sProcess3">更新密码中,请稍后...</span>
</div>
</div>

邮箱验证:

@{
ViewBag.Title = "PersonProfile";
Layout = "~/Views/Shared/_LayoutView.cshtml";
}
@section head{
<script src="@Url.Content("~/Scripts/person-profile.js")" type="text/javascript"></script>
}
<div class="pcontent">
<div class="pstep02">
<b>邮箱验证</b>
</div>
<div class="pstep03">
Change your personal profile
</div>
<div class="pstep04">
A strong personal profile helps prevent
</div>
<div style="letter-spacing: 1.5px; color: #666;">
Verification code is obtained by mail
</div>
<ul class="ulstep">
<li class="liTOP"><b>Name</b></li>
<li>
<input id="name" name="" type="text" class="a01input" value="@ViewBag.idcode" readonly>
</li>
<li class="liTOP"><b>ITcode</b></li>
<li>
<input id="itCode" name="" type="text" value="@ViewBag.idcode" class="a01input" readonly>
</li>
<li class="liTOP"><b>personal email</b></li>
<li>
<input id="personalemail" name="" type="text" class="a01input">
</li>
<li></li>
</ul>
<div class="topw">
<input type="button" id="ValidateEmail" value="Save" class="btnSave" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" id="UserCancel" value="Cancel" class="btnCancel" />
</div>
<div id="Loading3" style="display: none">
<img src="../img/grid-loading.gif" /><span id="sProcess3">更新密码中,请稍后...</span>
</div>
</div>

绑定页面

else if (data == "S") {//绑定页面
location.href = "../Home/PersonProfile?idcode=" + sItcode+ "&bindEmail="+sUserEmail;
return;
}
else {
alert("邮件发送失败,请联系系统管理员.");
$("#backgray").css("display", "none");
closePopup();
return;
}
});
});
});
}
function Reset(i, o, n, r) {
if (i == 0) {
$("#itcode").val("");
}
if (o == 0) {
$("#oldpwd").val("");
}
if (n == 0) {
$("#newpwd").val("");
}
if (r == 0) {
$("#rtpwd").val("");
}
}
function isMail(t) {
//reg = new RegExp('^[a-zA-Z0-9]+@[a-zA-Z0-9]+.[a-z][a-z.]{2,8}$');
var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
if (myreg.test(t)) {
return true;
// if (t.indexOf("Iiosoft") >= 0) {
// return true;
// }
// else {
// return false;
// }
} else {
return false;
}
}
function ChangePwd() {
$("#Loading3").css("display", "");
var sItCode = $.trim($("#itcode").val());
var sOldPwd = $.trim($("#oldpwd").val());
var sNewPwd = $.trim($("#newpwd").val());
var sRtPwd = $.trim($("#rtpwd").val());
if (sItCode == "") {
alert("请输入用户账号.");
Reset(0, 0, 0, 0);
return;
}
if (sRtPwd != sNewPwd) {
alert("两次输入密码不相同,请重新输入.");
Reset(1, 1, 0, 0);
return;
}
$.post(
"../Home/ChangePwd",
{ sItCode: sItCode, sOldPwd: sOldPwd, sNewPwd: sNewPwd, random: Math.random() },
function (data) {
$("#Loading3").css("display", "none");
if (data != "") {
if (data == "CS") {
alert("用户密码修改成功.");
Reset(0, 0, 0, 0);
//window.location.href = "http://iio-mail01/ChgUpwd.nsf/internetpwd?OpenForm";
} //忘了user01 de 密码。。
else if (data == "TR") {
alert("新密码不满足密码策略,请重新输入使新密码满足最小密码长度8位、密码复杂性和历史密码5次不重复的要求!");
Reset(1, 1, 0, 0);
}
else if (data == "EP") {
alert("错误的登录密码.");
Reset(1, 0, 0, 0);
}
else if (data == "NU") {
alert("用户不存在.");
Reset(0, 0, 0, 0);
}
return;
}
else {
alert("系统出错,请联系系统管理员.");
return;
}
});
}
function adminLogin() {
$("#Loading3").css("display", "");
var username = $.trim($("#username").val());
var password = $.trim($("#password").val());
if (username == "") {
alert("请输入用户账号.");
Reset(0, 0, 0, 0);
return;
}
if (password == "") {
alert("请输入密码.");
Reset(1, 1, 0, 0);
return;
}
$.post(
"../Home/LoginAutheration",
{ username: username, password: password, random: Math.random() },
function (data) {
$("#Loading3").css("display", "none");
if (data != "") {
if (data == "CS") {
alert("用户密码错误.");
Reset(0, 0, 0, 0);
} else if (data == "FA") {
alert("当前用户没有权限.");
Reset(0, 0, 0, 0);
} else if (data == "SU") {
window.location.href = "../Home/resetpwd"
}
return;
}
else {
alert("系统出错,请联系系统管理员.");
return;
}
});
}
function ResetSinglePwd() {
$("#Loading3").css("display", "");
var sItCode = $.trim($("#itcode").val());
var sOldPwd = "123";
var sNewPwd = $.trim($("#newpwd").val());
var sRtPwd = $.trim($("#rtpwd").val());
var code = $.trim($("#code").val());
if (sItCode == "") {
alert("请输入用户账号.");
Reset(0, 0, 0, 0);
return;
}
if (sRtPwd != sNewPwd) {
alert("两次输入密码不相同,请重新输入.");
Reset(1, 1, 0, 0);
return;
}
$.post(
"../Home/SetPassword",
{ sItCode: sItCode, sOldPwd: sOldPwd, sNewPwd: sNewPwd, code:code,random: Math.random() },
function (data) {
$("#Loading3").css("display", "none");
if (data != "") {
if (data == "CS") {
alert("用户密码修改成功.");
Reset(0, 0, 0, 0);
} //忘了user01 de 密码。。
else if (data == "TR") {
alert("新密码不满足密码策略,请重新输入使新密码满足最小密码长度8位、密码复杂性和历史密码5次不重复的要求!");
Reset(1, 1, 0, 0);
}
else if (data == "EP") {
alert("错误的登录密码.");
Reset(1, 0, 0, 0);
}
else if (data == "NU") {
alert("用户不存在.");
Reset(0, 0, 0, 0);
}
else if (data == "Verification code have failed")
{
location.href = "../Home/ApplySuccess?type=5";
}
return;
}
else {
alert("系统出错,请联系系统管理员.");
return;
}
});
}
function ResetAllPwd() {
$("#Loading3").css("display", "");
var sItCodes = $.trim($("#itallcode").val());
if (sItCodes == "") {
alert("请输入用户账号.");
Reset(0, 0, 0, 0);
return;
}
$.post(
"../Home/SetAllPassword",
{ sItCodes: sItCodes, random: Math.random() },
function (data) {
$("#Loading3").css("display", "none");
if (data != "") {
if (data == "CS") {
alert("用户密码修改成功.");
Reset(0, 0, 0, 0);
$("#itallcode").attr("value", "");
} //忘了user01 de 密码。。
else if (data == "TR") {
alert("新密码不满足密码策略,请重新输入使新密码满足最小密码长度8位、密码复杂性和历史密码5次不重复的要求!");
Reset(1, 1, 0, 0);
}
else if (data == "EP") {
alert("错误的登录密码.");
Reset(1, 0, 0, 0);
}
else if (data == "NU") {
alert("用户不存在.");
Reset(0, 0, 0, 0);
}
return;
}
else {
alert("系统出错,请联系系统管理员.");
return;
}
});
}

重置密码:

@{
ViewBag.Title = "Resetpwd";
Layout = "~/Views/Shared/_LayoutView.cshtml";
}
@section head{
<script src="@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>
<div id="resetsingle">
<ul class="ulstep">
<input name="" id="code" type="hidden" value="@ViewBag.Code" />
<li><b>Iiosoft Account</b> <!--a style="cursor: pointer;" id="Search">What's this?</!a--></li>
<li>
<input name="" id="itcode" type="text" value="@ViewBag.name" readonly 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>Recenter password </b></li>
<li>
<input name="" id="rtpwd" type="password" class="a01input" />
</li>
</ul>
<div class="topw">
<input type="button" id="UserSetSinglepwd" value="Save" class="btnSave" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" id="UserpwdCancel" value="Cancel" class="btnCancel" />
</div>
</div>
<div id="Loading3" style="display: none">
<img src="../img/grid-loading.gif" /><span id="sProcess3">更新密码中,请稍后...</span>
</div>
</div>

本地log生成记录

通过自助系统忘记密码

填写需要重置的用户信息、及私人邮箱

邮箱绑定

将绑定信息发送私人邮箱,进行绑定

私人邮箱收到的绑定信息,绑定确认链接

通过访问该链接进行绑定

绑定信息后,进行重置

提交后,重置信息将发送到绑定的私人邮箱中,进行重置

绑定的私人邮箱会收到一封邮件进行重置

重置用户信息,用户只需要输入新密码即可

重置后,我们可以在数据库下 查看绑定的信息

绑定后,我们可以在数据库下查看绑定后的信息

//查询resetpasswd数据库下dbo.userbind的绑定信息

select * from resetpasswd.dbo.userbind

//删除resetpasswd数据库下dbo.userbind的绑定信息

delete from changepassword.dbo.questioninfo where id in (1)

重置后在本地生成log文件:

转载于:https://blog.51cto.com/gaowenlong/1367571

域密码自助重置系统----绑定私人邮箱信息自助重置(一)相关推荐

  1. 如何在Win11重置系统中保留个人文件 Win11重置系统保留个人文件方法

    Win1系统是目前很多用户都在使用的电脑操作系统,但是最近安装的Win11系统有很多bug,很多用户想重置系统,但是不知道如何保留个人文件,下面小编就为大家详细的介绍一下,有需要的快来看看吧! Win ...

  2. 重置系统_开课了,如何重置电脑系统?1分钟教会你!

    #如何重置Windows 10系统?# 今天就来给大家分享一下 重要提示: 操作涉及恢复系统设置,有可能会造成数据损失,请操作前备份好个人重要数据,以免系统重置后数据丢失! 重置系统时需连接电源,否则 ...

  3. mac重置系统_如何在Mac上重置打印系统

    mac重置系统 Printers are notorious for failing frequently. A quick restart of the printer or computer us ...

  4. Springboot疫情防控学生自助申报系统 毕业设计-附源码260839

    springboot疫情防控学生自助申报系统 摘  要 随着社会的发展,社会的各行各业都在利用信息化时代的优势.计算机的优势和普及使得各种信息系统的开发成为必需. 自从2020年新冠疫情爆发以来,防疫 ...

  5. springboot疫情防控学生自助申报系统毕业设计源码260839

    springboot疫情防控学生自助申报系统 摘  要 随着社会的发展,社会的各行各业都在利用信息化时代的优势.计算机的优势和普及使得各种信息系统的开发成为必需. 自从2020年新冠疫情爆发以来,防疫 ...

  6. 微信qq邮箱提醒 服务器繁忙,微信设置密码失败,QQ无法绑定,邮箱服务器繁忙...

    满意答案 nthetm 2016.09.29 采纳率:52%    等级:8 已帮助:261人 QQ邮箱发邮件老是显示系统繁忙的原因及解决方法如下: 1.同一时间操作QQ邮箱的人员太多导致系统繁忙,可 ...

  7. 多门店共享无人自助洗车系统小程序开发

    多门店共享无人自助洗车系统小程序开发 共享自助洗车 互联网+模式 洗车成为刚需,自助洗车火爆进行中 汽车保有量持续上升 日常洗车需求量大.频次高 消费流量源源不断 传统洗车行业弊端 01成本高 门店租 ...

  8. 电影自助售票系统业务逻辑分析

    一站式自助票务系统业务逻辑分析: 一站式自助票务系统包含三部分:售票-->打票--->验票 通过售票按钮购买售票中活动的票,根据个人需求购票. 打票:选择我们所购买活动,同步数据,加载来自 ...

  9. html5重置按钮,25-普通按钮-提交按钮-重置按钮

    普通按用来控制其定义的脚本的处理工作. type="button" name="" value="" οnclick="" ...

最新文章

  1. load average
  2. 运营系统的前世今生(1)
  3. Debian 8 时间同步
  4. python plt调整子图间隔
  5. python 除法总返回浮点
  6. 使用Ahk2Exe工具将AutoHotKey脚本打包到Windows可执行文件
  7. 我来做百科(第七天)
  8. 软件的接口设计图_软件产品研发流程
  9. 天涯论坛_全球华人网上家园_天涯社区
  10. asp.net实现一个简易购物车功能。
  11. HTML文档繁转简,excel简繁转换 切换到“审阅”,点击“繁转简”:
  12. windows如何去除桌面图标箭头
  13. jeecg-boot环境搭建
  14. Qt在mac上的字体
  15. [web开发]建立本地php MySQL Apache测试服务器
  16. Dan计划:重新定义人生的10000个小时
  17. GNSS测量与数据处理(第十周)
  18. ViewPager中显示图片和播放视频填坑之旅
  19. Cadence 如何通过.dra(封装)查看使用哪个.pad(焊盘)文件
  20. 坚果G9致命缺点,一篇文章告诉你坚果G9到底好不好

热门文章

  1. mysql设置keepalived_MySQL高可用性之Keepalived+MySQL(双主热备)
  2. eureka自我保护时间_Spring Cloud Eureka 自我保护机制
  3. mysql数据库导入到excel表格数据_[转载]将EXCEL表格中的数据导入mysql数据库表中(两种方法)...
  4. 2021年春季学期-信号与系统-第八次作业参考答案-第十小题
  5. 电子小帮手电路中电源开关电路分析
  6. H01-P1201-0.6B金升阳高压模块
  7. automake生成静态库文件_动手 | 奶奶级的动态库入门
  8. win8mysql安装教程zip_mysql 8.0.18.zip安装配置方法图文教程(windows 64位)
  9. python出现套接字创建不成功_python套接字连接在Mac上被拒绝但在Windows
  10. 如何用python写程序设置当前打印机为默认打印机_从Python打印到标准打印机?