asp.net忘记密码功能
//调用接口 post
public string GetResponseByPost(string mobile, string messcode, string values, string utype)
{
HttpWebRequest webRequest = null;
StreamReader responseReader = null;
try
{
//ashx Url
string getGscUserUrl = "http://124.232.150.194:8120/SMS/SMSPost.ashx";
//加入参数,用于更新请求
string urlHandler = getGscUserUrl + "?mobile=" + mobile + "&messcode=" + messcode + "&values=" + values + "&utype=" + utype;
webRequest = (HttpWebRequest)HttpWebRequest.Create(urlHandler);
webRequest.Timeout = ;//3秒超时
//调用ashx,并取值
responseReader = new StreamReader(webRequest.GetResponse().GetResponseStream());
string currentUserGulid = responseReader.ReadToEnd();
return currentUserGulid.Trim();
}
catch
{
return "";
}
finally
{
responseReader.Close();
responseReader.Dispose();
}
}
//发送短信按钮(获取验证码)
protected void SendSMS_CallBack_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
{
int i=;
TUSERBll bll = new TUSERBll();
string mobile = tb_ForgetUtel.Text.Trim(); // 手机号
string userno = tb_ForgetUname.Text.Trim(); //用户名
string strRight = mobile.Substring(mobile.Length - i, i); //手机尾号
string messcode = ""; //模板编号
string codes = bll.Get_GetGenMescode(userno, mobile);
string values = codes + "," + strRight; //模板拼接参数
string utype = "";
string result = GetResponseByPost(mobile, messcode, values, utype); //System.Collections.Hashtable hs = new System.Collections.Hashtable();
//hs.Add("code", codes); //存验证码
//hs.Add("codetime",DateTime.Now.AddMinutes(15)); //验证码有效期15分钟
DateTime codetime=new DateTime();
codetime = DateTime.Now.AddMinutes();
Session["codes"] = codes; //取验证码
Session["codetime"] = codetime; //if (Session["codes"] != null)
//{
// System.Collections.Hashtable ht = new System.Collections.Hashtable();
// ht = Session["codes"] as System.Collections.Hashtable;
// DateTime dd = Convert.ToDateTime(ht["codetime"]); //发送验证码的时间 // //判断验证码是否过期
// if (Convert.ToDateTime(ht["codetime"]) == DateTime.Now)
// { // }
//}
//json返回值
MSG t = JsonConvert.DeserializeObject<MSG>(result);
string s_result = t.result; //判断输入的手机号码与用户名是否匹配
if(codes=="")
{
SendSMS_CallBack.JSProperties["cpFlag"] = "-1";
}
else
{
SendSMS_CallBack.JSProperties["cpFlag"] = s_result; //短信发送返回值
}
}
//立即重置按钮
protected void get_rechargeCallBack_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
{
string username = tb_ForgetUname.Text.Trim(); TUSERBll bll = new TUSERBll();
string s_coude = Convert.ToString(Session["codes"]); // 获取验证码
string ForgetUCodes = tb_ForgetUCodes.Text.Trim();
DateTime time = new DateTime();
time = Convert.ToDateTime(Session["codetime"]); //获取时间 if (s_coude!="")
{
string i = bll.Get_CheckMescode(ForgetUCodes);
if (time == DateTime.Now)
{
get_rechargeCallBack.JSProperties["cpFlag"] ="-2222";
}
else if (tb_ForgetUCodes.Text != s_coude)
{
get_rechargeCallBack.JSProperties["cpFlag"] = "-1111";
}
else if(i=="")
{
get_rechargeCallBack.JSProperties["cpFlag"] = i;
//tb_ForgetUname2.Text = username; //用户名称 Session["codes"] = null;
Session.Remove("codes");
Session["codetime"] = null;
Session.Remove("codetime"); }
else
{
get_rechargeCallBack.JSProperties["cpFlag"] = i;
} }
else if(tb_ForgetUCodes.Text != s_coude)
{
get_rechargeCallBack.JSProperties["cpFlag"] = "-1";
}
else
{
get_rechargeCallBack.JSProperties["cpFlag"] = "-1";
} }
asp.net忘记密码功能的更多相关文章
- C#.NET 大型通用信息化系统集成快速开发平台 4.1 版本 - 忘记密码功能改进、手机短信、电子邮件
由于我们的系统接近有100000个用户账户,经常会有忘记密码的时候,用户多了,很小的一个功能,每天都会有很多人在用,每个功能都非常友善,会提高提系统的效率,提高用户体验. 一天最多能返回3次手机短信, ...
- Android忘记密码功能实现
连续好几天学习都没有什么进展,然而在今天这个烂漫的日子.突然有了学习的动力.想起来前几日老师给布置的android忘记密码的功能实现.今天也有了想法.就是按照老师的建议,简单的回答一个问题,实现此功能 ...
- java web实现 忘记密码(找回密码)功能及代码
java web实现 忘记密码(找回密码)功能及代码 (一).总体思路 (二).部分截图 (三).部分代码 (一).总体思路: 1.在 找回密码页面 录入 姓名.邮箱和验证码,录入后点击[提交]按钮, ...
- django 开发忘记密码通过邮箱找回功能
一.流程分析: 1.点击忘记密码====>forget.html页面,输入邮箱和验证码,发送验证链接网址的邮件====>发送成功,跳到send_success.html提示 2.到邮箱里找 ...
- Linux-1:安装&忘记密码&CRT连接centos 6.5
我是在虚拟机VM安装的centos 6.5 一.Linux安装 Ctrl + Alt:鼠标退出LINUX界面 安装我是参考,当然也可以根据网上教程安装:http://oldboy.blog.51cto ...
- SharePoint重置密码功能Demo
博客地址 http://blog.csdn.net/foxdave 本文将说明一个简单的重置SharePoint用户密码(NTLM Windows认证)的功能如何实现 重置密码功能,实际上就是重置域用 ...
- wordpress忘记密码重置
一直使用浏览器记录密码的方式登陆wordpress,直到有一天重装系统,而浏览器的记录又没有备份,结果怎么也想不起当初所设定的密码了…… -_-||| 遂google了一番,发现了直接修改数据库重设密 ...
- javaWeb实现使用邮箱邮件找回密码功能
JSP+Jmail+JavaBean 发邮件(转)2010-08-23 18:052007年04月14日 14:32/* * SendMail.java * * Created on 2007年3月3 ...
- JavaMail学习笔记(七)、帐号激活与忘记密码 实例(zhuan)
一.帐户激活 在很多时候,在某些网站注册一个用户之后,网站会给这个用户注册时填写的email地址发送一封帐户激活邮件,这封邮件的内容就是一个激活帐户的链接和一段简短的文字描述,如果用户没有去邮箱将 ...
随机推荐
- Tomcat 在mac中Operation not permitted
5.执行/Library/Tomcat/bin下的startup.sh,然后打开http://localhost:8080查看是否Tomcat已经启动,若要停止服务器就运行同目录下的shutdown. ...
- mysql 的max_connections和max_user_connections 的区别
----查看max_user_connections 默认值 MySQL> show variables like 'max_user_connections'; +-------------- ...
- 转:Android开发:使用JNI读取应用签名
博文转自http://www.tuicool.com/articles/UVjme2r,感谢博主的分享 为了防止被反编译,打算把关键代码写到so里(比如加解密),在so里加上判断APk包签名是否一致的 ...
- JS正则截取两个字符串之间的字符串
match方法 var str = "iid0000ffr"; var substr = str.match(/id(\S*)ff/); console.log(substr) 返 ...
- 长文丨papi、咪蒙、罗胖之后,内容创业的机会在哪儿
一.内容的一年 app死了,内容永生! 2016年,创业圈画风突变,昨天还在激辩java和PHP谁更好的技术宅们.还在梦想着成为第二个乔布斯改变世界的产品狗们.还在忽悠着用O2O横扫传统行业的小老板们 ...
- 学习地址(oraclemysqllinux)
1.安装配置 http://blog.chinaunix.net/uid-27126319-id-3466193.htmlhttp://www.cnblogs.com/gaojun/archive/2 ...
- 简述cookie
1.Cookie的概述 * Cookie是客户端的技术(默认把Cookie保存在每个用户的浏览器上) * 程序把每个用户的数据以cookie的形式写给用户各自的浏览器 * 当用户使用浏览器再去访问服务 ...
- [转] Linux下 config/configure/Configure、make 、make test/make check、sudo make install 的作用
转自:http://blog.csdn.net/secondjanuary/article/details/8985795 这些都是典型的使用GNU的AUTOCONF和AUTOMAKE产生的程序的安装 ...
- javascript工具函数
第一部分 JavaScript工具函数 转义特殊字符为html实体 HtmlEncode: function(str){ return str.replace(/&/g, '&') ...
- Best Practices for Performance_3.Improving Layout Performance 优化布局
http://developer.android.com/training/improving-layouts/index.html 1. 优化布局层次 1) 每增加一个View或者布局,都会增加额 ...