重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
域密码修改及忘记密码流程系统
成都创新互联主要从事网站建设、网站设计、网页设计、企业做网站、公司建网站等业务。立足成都服务七里河,10余年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18982081108
说到域大家都并不陌生了,现企业内都有域环境;一般50人以上都会通过域做管理,这样比较方便,做应用也比较方便,总之管理更方便。今天主要介绍不如部署环境内密码修改及遗忘密码流程系统。具体见下:
1. 通过自己的需求写代码:
1》用户可以通过员工编号,查询自己的账户‘
2》如果忘记自己的密码,可以通过Forgot功能验证信息完成密码重置
3》通过该流程系统可修改自己的密码
环境介绍:
Domain:Iiosoft.com
Hostname:Iiosoft-dc
Ip:10.1.1.254
Roles:dc、DNS
Hostname:iiosoft-mail01
Ip:10.1.1.11
Roles:domino server
因为之前我的代码已经写完了,代码就不做详细介绍了,我将源代码共享给大家,如果有兴趣可下载并修改使用
首先是要安装visual studio
在此功能我选择全部
安装完成
先安装mvc
我们先将事先编写好的程序代码打开
我们编辑web.conf文件;可以根据自己的真实还行进行修改
重置密码流程
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ChangePassword.Models; using System.Web.Caching; namespace ChangePassword.Controllers { public class HomeController : Controller { // // GET: /Home/ public ActionResult Index() { return View(); } public ActionResult ACSearchView() { return View(); } public ActionResult GetYourAccount() { return View(); } public ActionResult FgPasswordView() { return View(); } ////// 进入申请密码重置页面 /// ///public ViewResult PersonProfile() { string code = Request["Code"]; ViewBag.Code = ""; if (code != null) { ViewBag.Code = code; } return View(); } public ViewResult ApplySuccess(string type) { if (type == "1") { ViewBag.Msg = "重置密码的验证码已经发送到私人邮箱,请到私人邮箱获取验证码提交密码重置申请。"; ViewBag.MsgEn = "Authentication code has been sent to the private E-mail, please get the verification code from the private E-mail and submit it"; } else if (type == "2") { ViewBag.Msg = "感谢使用ChangePassword,您的密码重置结果将于24小时内发送至您的私人邮箱,请注意查收。"; ViewBag.MsgEn = "Thanks to use ChangePassword System, the reset result of your password will be sent to your personal email within 24 hours, please pay attention to check."; } return View(); } public JsonResult ChangePwdApplyFor(string sname, string sitCode, string sdepartment, string semployeeNumber, string stelephone, string smamagerName, string sverificationCode, string random) { string Rs = ""; // 1.验证所填信息 if (string.IsNullOrEmpty(sname) || string.IsNullOrEmpty(sitCode) || string.IsNullOrEmpty(semployeeNumber)) { Rs = "name and itcode and employee number not be null"; } else { // 2. 验证码是否正确 string privateEmail = (string)HttpContext.Cache[sitCode+"_PrivateEmail"]; string verificationCode = (string)HttpContext.Cache[sitCode]; if (string.IsNullOrEmpty(verificationCode) || sverificationCode.Trim() != verificationCode) { Rs = "Verification code have failed"; } else { // 3.发送邮件到IS 邮箱 Mails m = new Mails(); bool s = m.SendMail(sname, sitCode, sdepartment, semployeeNumber, stelephone, smamagerName, privateEmail); if (s) { Rs = "S"; } else { Rs = "F"; } } } return Json(Rs); } public void GetItcode() { string sUserId = Request["sUserId"]; Users u = new Users(); string itcode = u.GetUserItcode(sUserId); Response.Write(itcode.ToString()); } public JsonResult SendFgEmail(string sUserEmail,string sItcode) { Random random = new Random(); string randomCode = random.Next(10000, 99999).ToString(); HttpContext.Cache.Insert(sItcode, randomCode, null, DateTime.Now.AddMinutes(30), Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.High, null); HttpContext.Cache.Insert(sItcode + "_PrivateEmail", sUserEmail, null, DateTime.Now.AddMinutes(30), Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.High, null); Mails m = new Mails(); bool s = m.SendMail(sUserEmail, sItcode, randomCode); string Rs = ""; if (s) { Rs = "S"; } else { Rs = "F"; } return Json(Rs); } //public void SendFgEmail() //{ // string sUserEmail = Request["sUserEmail"]; // string sItcode = Request["sItcode"]; // string sPhone = Request["sPhone"]; // sItcode = sUserEmail.Split('@')[0]; // Mails m = new Mails(); // bool s = m.SendMail(sUserEmail, sItcode, sPhone); // string Rs = ""; // if (s) // { // Rs = "S"; // } // else // { // Rs = "F"; // } // Response.Write(Rs.ToString()); //} 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"; } else { Rs = "TR"; } } else { Rs = "EP"; } } else { Rs = "NU"; } ao.dispose(); Response.Write(Rs.ToString()); } //重置密码 [HttpGet] public void SetPassword() { string sItCode = Request["sItCode"]; string sNewPwd = Request["sNewPwd"]; ADOperator.SetPasswordByAccount(sItCode, sNewPwd); } } } 修改页面信息: <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage " %> Account Search
员工编号: Iiosoft Account
加载数据中,请稍后...
Note: Have any questions? Please contact IS.
PhoneNumber: 010-82821000-1000
Mail: is@Iiosoft.com
配置web.config文件
修改完信息后,需要重新生成解决方案
然后我们进行发布;发布后的信息可通过iis部署网站,然后通过iis浏览了
发布默认即可
发布路径:任意地址即可再次:D:\iis\changpwd
发布成功
然后我们安装及打开IIS;添加网站
选择刚才发布的路径:D:\iis\changepwd
为了保证服务正常运行,我更改默认端口80,从80更改8090;同时绑定地址
修改NETframwork的版本,更改为版本4.0
测试结果
我们将通过修改user01、user02的用户进行测试
输入user01的原密码及新密码进行确认
提交确认
修改完成
如果用户忘记自己的密码---Forgot password
输入用户名及收验证码的邮箱,提交
已发送成功
然后查看收到的信息,此时该信息is系统也会说到,当填写相关验证信息后,is会有人回复新密码到该邮箱
下期我们将通过该功能让域密码跟邮箱密码进行同步