public ActionResult Login(Condition condition) { try { LoginUser LoginUser = new LoginUser(); DataRow data = LoginUser.GetLoginUser(condition); if (data != null) { // セッションへの格納 Session["GroupCode"] = data["PROCESS_CD"].ToString(); Session["UserId"] = data["EMPLOYEE_CD"].ToString(); condition.PROCESS_CD = data["PROCESS_CD"].ToString(); return(View("Menu", condition)); } else { ModelState.AddModelError(string.Empty, Resources.TextResource.ErrorLogin); return(View(condition)); } } catch (Exception ex) { logger.Debug("LOGIN ERROR: " + ex.ToString()); ModelState.AddModelError(string.Empty, Resources.TextResource.ErrorGetUser); return(View(condition)); } finally { } }
public ActionResult Login() { var json = Request.Form["data"]; JObject jo = JObject.Parse(json); var username = jo.GetValue("username").ToString(); var password = jo.GetValue("password").ToString(); if (username.IsNotEmpty() && password.IsNotEmpty()) { var logUser = LoginUser.GetLoginUser(username, password); if (logUser != null) { return(Content("/admin")); } } return(Content("failed")); }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { base.OnActionExecuting(filterContext); //Session.Clear(); if (Session[Const.PC_USRE_INFO] != null) { //Session里存在 说明登录过 lUser = Session[Const.PC_USRE_INFO] as LoginUser; } else { #if DEBUG LoginUser.GetLoginUser("admin", "e6f59560edc55d422647b50df2ed6113"); #else filterContext.Result = RedirectToAction("index", "login"); #endif } }