public ActionResult LoginAjax(string ReturnUrl) { Users users = new Users { UserName = Request["username"], Password = Request["password"] }; var res = _repository._UserRepositories.ValidateUser(users); if (res == 0) { return(Json(new { Result = "Error", Message = "用户不存在" })); } else if (res == 1) { return(Json(new { Result = "Error", Message = "密码错误" })); } else if (res == 2) { return(Json(new { Result = "Error", Message = "帐号未激活" })); } else { bool PersistentCookie = false; if (Request["rememberpassword"] == "on") { PersistentCookie = true; } FormAuthService.SignIn(users.UserName, PersistentCookie, new string[] { "user" }); return(Json(new { Result = "OK", Message = ReturnUrl })); } }
public ActionResult Activation() { try { string username = Request.QueryString["n"]; string mid = Request.QueryString["mid"]; var n = _repository._UserRepositories.GetUserByUserName(new Users { UserName = username }); if (n.Mid == mid) { n.Status = 1; n.Mid = Guid.NewGuid().ToString(); _repository._UserRepositories.UpdateUserStatusAndMid(n); FormAuthService.SignIn(n.UserName, false, new string[] { "user" }); return(View()); } else { return(Redirect("/404.htm")); } } catch { return(Redirect("/404.htm")); } }