public ActionResult CreateUser(bool?post, string name, string pwd, string rpwd) { string result = ""; if (!HttpContext.Request.IsLocal) { result = "must internal access!"; return(View((object)result)); } if (post != null && post.Value) { if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(pwd)) { result = "user name or password not available"; } else if (pwd != rpwd) { result = "password do not match"; } else { Log4Grid.Models.User user = mFactory.User.Create(name, pwd, "", true); if (user == null) { result = "user already exists"; } else { result = "create user success"; } } } return(View((object)result)); }
public ActionResult Login(bool?post, string name, string pwd) { string result = ""; if (post != null && post.Value) { Log4Grid.Models.User user = mFactory.User.Login(name, pwd); if (user != null) { Codes.Utils.SetLogin(user.Name); return(new RedirectResult("/")); } result = "user name or password not available"; } return(View((object)result)); }