示例#1
0
 public ActionResult AjaxLogin(string UserName, string UserPwd)
 {
     if (!base.ModelState.IsValid)
     {
         return base.Content("0");
     }
     AccountsPrincipal existingPrincipal = AccountsPrincipal.ValidateLogin(UserName, UserPwd);
     if (existingPrincipal == null)
     {
         return base.Content("0");
     }
     User user = new User(existingPrincipal);
     if (!user.Activity)
     {
         base.ModelState.AddModelError("Message", "对不起,该帐号已被冻结,请联系管理员!");
     }
     base.HttpContext.User = existingPrincipal;
     FormsAuthentication.SetAuthCookie(UserName, true);
     base.Session[Globals.SESSIONKEY_USER] = user;
     int num = new PointsDetail().AddPoints("Login", user.UserID, "登录操作", "");
     return base.Content("1|" + num.ToString());
 }
示例#2
0
 public ActionResult Login(LogOnModel model, string returnUrl)
 {
     ((dynamic) base.ViewBag).Title = "登录";
     if (!base.ModelState.IsValid)
     {
         return base.View(model);
     }
     AccountsPrincipal existingPrincipal = AccountsPrincipal.ValidateLogin(model.Email, model.Password);
     if (existingPrincipal == null)
     {
         base.ModelState.AddModelError("Message", "用户名或密码不正确, 请重新输入!");
         return base.View(model);
     }
     User user = new User(existingPrincipal);
     if (!user.Activity)
     {
         base.ModelState.AddModelError("Message", "对不起,该帐号已被冻结,请联系管理员!");
         return base.View(model);
     }
     base.HttpContext.User = existingPrincipal;
     FormsAuthentication.SetAuthCookie(model.Email, model.RememberMe);
     base.Session[Globals.SESSIONKEY_USER] = user;
     int num = new PointsDetail().AddPoints("Login", user.UserID, "登录操作", "");
     if ((base.Session["ReturnUrl"] != null) && !string.IsNullOrWhiteSpace(base.Session["ReturnUrl"].ToString()))
     {
         returnUrl = base.Session["ReturnUrl"].ToString();
         base.Session.Remove("ReturnUrl");
         return this.Redirect(returnUrl);
     }
     if (((base.Url.IsLocalUrl(returnUrl) && (returnUrl.Length > 1)) && (returnUrl.StartsWith("/") && !returnUrl.StartsWith("//"))) && !returnUrl.StartsWith(@"/\"))
     {
         return this.Redirect(returnUrl);
     }
     base.TempData["pointer"] = num;
     return base.RedirectToAction("Index", "Home", new { area = "CMS" });
 }
示例#3
0
 public ActionResult AjaxAddPoint(string Type)
 {
     int num = 0;
     PointsDetail detail = new PointsDetail();
     if (Type == "Product")
     {
         num = detail.AddPoints("Product", base.currentUser.UserID, "发布商品", "");
     }
     else if (Type == "Photo")
     {
         num = detail.AddPoints("Photo", base.currentUser.UserID, "分享照片", "");
     }
     else
     {
         num = detail.AddPoints("Post", base.currentUser.UserID, "发布动态", "");
     }
     return base.Content(num.ToString());
 }