public ActionResult LogOn(string username, string password, bool?auto, string returnUrl, FormCollection form) { //验证码必填项及验证码 if (string.IsNullOrEmpty(username)) { Common.VerifyCodeHelper.ChangeCode(); return(Content(ContentIcon.Error + "|请输入用户名")); } if (string.IsNullOrEmpty(password)) { Common.VerifyCodeHelper.ChangeCode(); return(Content(ContentIcon.Error + "|请输入密码")); } string verifycode = form["verifycode"]; if (string.IsNullOrEmpty(verifycode)) { Common.VerifyCodeHelper.ChangeCode(); return(Content(ContentIcon.Error + "|请输入验证码")); } else { if (Session["verifyCode"] == null) { Common.VerifyCodeHelper.ChangeCode(); return(Content(ContentIcon.Error + "|验证码已过期,请刷新验证码")); } else { if (verifycode.ToLower() != Session["verifyCode"].ToString().ToLower()) { Common.VerifyCodeHelper.ChangeCode(); return(Content(ContentIcon.Error + "|验证码不正确")); } } } //登录验证用户名、密码 string url = string.Empty; string _message = string.Empty; if (auto == null) { auto = false; } bool _true = CurrentMember.LogOn(username, password, (bool)auto, out _message); if (_true) { url = "/admin"; //防跳转钓鱼 if (!string.IsNullOrEmpty(returnUrl) && Url.IsLocalUrl(url)) { url = returnUrl; } else { url = "/admin"; } Common.VerifyCodeHelper.ChangeCode(); return(Content(ContentIcon.Succeed + "|" + _message + "|" + url)); } else { Common.VerifyCodeHelper.ChangeCode(); return(Content(ContentIcon.Error + "|" + _message)); } }