/// <summary> /// 登录验证 /// </summary> /// <param name="filterContext"></param> protected override void OnAuthorization(AuthorizationContext filterContext) { _ActionName = filterContext.ActionDescriptor.ActionName; _ControllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName; string _ControllerType = filterContext.ActionDescriptor.ControllerDescriptor.ControllerType.ToString(); if (_ControllerType != "AgentMobile.Controllers." + _ControllerName + "Controller") { filterContext.Result = GetErrorResult("若继承BaseController则该控制器只能使用默认后缀Controller和命名空间只能使用AgentMobile.Controllers", null); return; } if (Session["C_Consumer_UserName"] == null) { filterContext.Result = GetErrorResult(string.Empty, null, "login"); return; } UserName = Session["C_Consumer_UserName"].ToString(); if (string.IsNullOrWhiteSpace(UserName)) { filterContext.Result = GetErrorResult(string.Empty, null, "login"); return; } CurrentUser = C_Consumer.GetEntityByUserName(UserName); if (CurrentUser == null) { //重新登录 filterContext.Result = GetErrorResult(string.Empty, null, "login"); return; } if (CurrentUser == null) { filterContext.Result = GetErrorResult(string.Empty, null, "login"); return; } if (CurrentUser.Stat == "未审核" && CurrentURL != "/j_shop/noaudit") { filterContext.Result = GetErrorResult("您的账号正在审核中,请稍候再查看", "你的账号还未审核"); return; } }
public ActionResult ziliao(C_Consumer user) { if (string.IsNullOrWhiteSpace(user.Mobile)) { return(Content("请输入手机号")); } if (user.Mobile.Length != 11) { return(Content("手机号不正确")); } if (string.IsNullOrWhiteSpace(user.Name)) { return(Content("请输入姓名")); } if (string.IsNullOrWhiteSpace(user.IDCard)) { return(Content("请输入身份证号码")); } if (string.IsNullOrWhiteSpace(user.Sex)) { return(Content("请选择性别")); } string addressStr = Request["PCAids"]; if (string.IsNullOrWhiteSpace(addressStr)) { return(Content("请选择所在地")); } string[] addre = addressStr.Split(','); string Province = ""; string City = ""; string Area = ""; for (int i = 0; i < addre.Length; i++) { if (i == 0) { Province = addre[i]; } else if (i == 1) { City = addre[i]; } else if (i == 2) { Area = addre[i]; } } C_Consumer old = C_Consumer.GetEntityByUserName(CurrentUser.UserName); old.Mobile = user.Mobile; old.Name = user.Name; old.IDCard = user.IDCard; old.Sex = user.Sex; old.Province = Province; old.City = City; old.Area = Area; old.UpdateByID(); return(Content("ok")); }
public ActionResult toreg(C_Consumer c) { c.UserName = c.UserName.Trim(); c.Pwd = c.Pwd.Trim(); c.Mobile = c.UserName; c.Type = "促销员"; c.Stat = "未审核"; string addressStr = Request["PCAids"]; if (string.IsNullOrWhiteSpace(addressStr)) { return(Content("请选择所在地")); } string[] addre = addressStr.Split(','); for (int i = 0; i < addre.Length; i++) { if (i == 0) { c.Province = addre[i]; } else if (i == 1) { c.City = addre[i]; } else if (i == 2) { c.Area = addre[i]; } } if (string.IsNullOrWhiteSpace(c.UserName)) { return(Content("手机号不能为空")); } if (string.IsNullOrWhiteSpace(c.Pwd)) { return(Content("密码不能为空")); } if (c.Pwd != c.pwdconfirm) { return(Content("两次输入密码不一致")); } C_Consumer oldc = C_Consumer.GetEntityByUserName(c.UserName); if (oldc != null) { return(Content("该手机号已注册")); } c.DatReg = DateTime.Now; c.ID = c.InsertAndReturnIdentity(); if (c.ID > 0) { return(Content("ok")); } return(Content("注册失败")); }