Ejemplo n.º 1
0
        public ActionResult Login(Panasia.Gemini.FL.Models.LoginModel model)
        {
            if (ModelState.IsValid)
            {
                var loginModel = new LoginViewModel {
                    UserName = model.UserName, Password = model.Password
                };

                if (!loginModel.WebLogin(false))
                {
                    ModelState.AddModelError("", Messages.System_InvalidUserNameOrPassword);
                    this.AddSystemLog("登录失败", "Account/Login", Messages.System_InvalidUserNameOrPassword, model.UserName);
                    return(View(model));
                }
                else
                {
                    UserSession session = new UserSession();
                    session.UserModel      = SysService.GetUserModel(model.UserName);
                    session.Roles          = SysService.GetRoles();
                    Session["userSession"] = session;
                    this.AddSystemLog("登录成功", "Account/Login", "UserName:"******"login");
                        System.Data.DataRow row   = dsLoginInfo.Tables[0].Rows[0];
                        foreach (System.Data.DataColumn col in dsLoginInfo.Tables[0].Columns)
                        {
                            login.Values.Add(col.ColumnName, HttpUtility.UrlEncode(row[col.ColumnName].ToString()));
                        }

                        login.Expires = DateTime.Now.AddDays(1);
                        Response.Cookies.Add(login);

                        Response.Redirect("~/");
                    }
                    else
                    {
                        ViewBag.LoginError = true;
                    }
                    return(null);
                }
            }

            //if (ValidateUser(model.UserName, model.Password))
            //{
            //    QX(model.UserName);
            //    return RedirectToAction("Rc006", "Interview_Info");
            //}
            return(View("Fl000"));
        }
Ejemplo n.º 2
0
        public ActionResult UpdateUserRole()
        {
            try
            {
                var      userID = Request["UserID"];
                string[] roles  = Request["Roles[]"].Split(',');
                SysService.SaveUserRole(userID, roles);


                return(Json(ResultData.Create(SysService.GetUserModel(userID)), "text/html"));
            }
            catch (Exception ex)
            {
                return(Json(ResultData.CreateError(ex.Message), "text/html"));
            }
        }
Ejemplo n.º 3
0
 public ActionResult Login(LoginViewModel model, string ReturnUrl = "")
 {
     if (ModelState.IsValid)
     {
         if (!model.WebLogin())
         {
             ModelState.AddModelError("", Messages.System_InvalidUserNameOrPassword);
             this.AddSystemLog("登录失败", "Account/Login", Messages.System_InvalidUserNameOrPassword, model.UserName);
         }
         else
         {
             UserSession session = new UserSession();
             session.UserModel      = SysService.GetUserModel(model.UserName);
             session.Roles          = SysService.GetRoles();
             Session["userSession"] = session;
             this.AddSystemLog("登录成功", "Account/Login", "UserName:" + model.UserName, session.UserModel.FullName);
             return(null);
         }
     }
     return(View(model));
 }
Ejemplo n.º 4
0
        public ActionResult Detail(string ID)
        {
            var model = SysService.GetUserModel(ID);

            return(View(model));
        }