protected void Page_Load(object sender, EventArgs e) { site_supplier = new Site_Supplier(); CookieTool.DeleteCookie("User"); Response.Redirect(site_supplier.AdminPath + "/login.aspx?url=" + HttpUtility.UrlEncode(RequestTool.GetUrlReferrerNonDomain()) + ""); }
/// <summary> /// 验证微信是否已经授权-绑定账号 /// </summary> public void wechatbind() { if (CurrentUser.bind_weixin_id != "") { CookieTool.DeleteCookie("qrcodeid"); Response.Write("{\"msg\":\"OK\"}"); return; } Response.Write("{\"msg\":\"NO\"}"); }
/// <summary> /// 管理员退出登录 /// </summary> /// <returns></returns> public void LoginOut() { try { Log.Add("退出系统", "Login", EX_Admin.CurrentAdmin().id.ToString(), EX_Admin.CurrentAdmin()); CookieTool.DeleteCookie("Master"); Response.Write("OK"); } catch { } }
/// <summary> /// 管理员退出登录 /// </summary> /// <returns></returns> public void LoginOut() { try { Log.Add("退出系统", "Login"); CookieTool.DeleteCookie("User"); Response.Write("OK"); } catch { } }
/// <summary> /// 退出登录 /// </summary> public void User_LoginOut() { CookieTool.DeleteCookie("User"); string url = URL("P_Index", ""); if (IsWechat()) { if (url.Contains("&weixinlogin=1")) { url = url.Replace("&weixinlogin=1", ""); } else { url = url.Replace("?weixinlogin=1", ""); } } Response.Write("{\"msg\":\"OK\",\"mes\":\"" + Tag("已退出登录") + "\",\"url\":\"" + url + "\"}"); }
/// <summary> /// 验证微信是否已经授权-登陆账号 /// </summary> public void wechatlogin() { string cid = CookieTool.GetCookieString("qrcodeid"); int id = 0; if (cid != "") { int.TryParse(cid, out id); Lebi_weixin_qrcode model = B_Lebi_weixin_qrcode.GetModel(id); if (model != null) { if (model.User_id > 0) { //CookieTool.SetCookieString("qrcodeid", "0", -1); CookieTool.DeleteCookie("qrcodeid"); Lebi_User user = B_Lebi_User.GetModel(model.User_id); EX_User.LoginOK(user); Response.Write("{\"msg\":\"OK\"}"); return; } } } Response.Write("{\"msg\":\"NO\"}"); }
/// <summary> /// 用户登录 /// </summary> public void User_Login() { string verifycode = RequestTool.RequestString("verifycode"); string UserName = RequestTool.RequestSafeString("UserName"); string PWD = RequestTool.RequestSafeString("Password"); string token = RequestTool.RequestString("token"); string url = ""; if (SYS.Verifycode_UserLogin == "1") { string loginerror = "false"; try { loginerror = (string)HttpContext.Current.Session["loginerror"]; } catch { loginerror = "false"; } if (loginerror == "true") { if (CurrentCheckCode != verifycode && CurrentCheckCode != "") { Response.Write("{\"msg\":\"" + Tag("验证码错误") + "\"}"); return; } } } if (EX_User.UserLogin(UserName, PWD)) { CurrentUser = EX_User.CurrentUser(); if (ShopCache.GetBaseConfig().IsOpenUserEnd == "1") { if (CurrentUser.Time_End < System.DateTime.Now) { Response.Write("{\"msg\":\"" + Tag("账号已过期") + "\"}"); CookieTool.DeleteCookie("User"); return; } } url = RequestTool.RequestString("url").Replace("<", "").Replace(">", ""); if (EX_User.MD5(SYS.InstallCode + url) != token) { url = URL("P_Index", ""); } if (url.ToLower().IndexOf("http") > -1 || url.ToLower().IndexOf(URL("P_Register", "").ToLower()) > -1 || url.ToLower().IndexOf(URL("P_Login", "").ToLower()) > -1 || url == "") { url = URL("P_Index", ""); } if (SYS.Verifycode_UserLogin == "1") { HttpContext.Current.Session["loginerror"] = "false"; } Response.Write("{\"msg\":\"OK\",\"url\":\"" + url + "\"}"); } else { if (SYS.Verifycode_UserLogin == "1") { HttpContext.Current.Session["loginerror"] = "true"; } Response.Write("{\"msg\":\"" + Tag("用户名或密码错误") + "\"}"); } }