public IActionResult Login([FromBody] LoginModel model) { var result = LogonUtility.Logon(model); return(Json(result, new JsonSerializerSettings { ContractResolver = new DefaultContractResolver() })); }
protected void btnLogon_Click(object sender, EventArgs e) { string message; if (LogonUtility.Logon(this.txtUserName.Text.Trim(), this.txtPassword.Text, this.txtCode.Text.Trim(), chkJizhu.Checked, out message)) { userLogonSuccess(); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "tip", "msg = '" + message.Replace("\n", string.Empty).Replace("\r", string.Empty) + "'", true); } }
//自动登录 private void AutoLogin() { HttpCookie c*k = Request.Cookies["userKey"]; //获取上次登录保存的cookice if (c*k != null && c*k.Values["user"] != null) { string user = c*k.Values["user"]; string message; if (user.Split('|').Length < 2) { return; } if (LogonUtility.Logon(LogonUtility.Decode(GetDecode(user.Split('|')[0])), LogonUtility.Decode(GetDecode(user.Split('|')[1])), false, out message)) { userLogonSuccess(); } } }
/// <summary> /// 加载 /// </summary> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var userName = Request.QueryString["userName"]; var orderId = Request.QueryString["orderId"]; var time = Request.QueryString["time"]; var sign = Request.QueryString["key"]; var type = Request.QueryString["type"]; string message; if (validateArgs(userName, orderId, type, time, sign, out message) && LogonUtility.Logon(userName, out message)) { var urlParameter = HttpUtility.UrlEncode(string.Format("/OrderModule/Purchase/OrderPay.aspx?id={0}&type={1}", orderId, type)); Response.Redirect(string.Format("/Index.aspx?redirectUrl={0}", urlParameter)); } else { Response.Write(message); } } }
public ActionResult Login(string userName, string password, string validateCode) { var result = LogonUtility.Logon(userName, password, validateCode); return(Json(result)); }