示例#1
0
        public ActionResult Login(string name, string password)
        {
            if (string.IsNullOrEmpty(name) || name.Length > 16 || name.Length < 3)
            {
                return(Content("账号密码格式错误!"));
            }
            if (string.IsNullOrEmpty(password) || password.Length > 16 || password.Length < 6)
            {
                return(Content("账号密码格式错误!"));
            }
            var user = dal.GetModel(name);

            if (user == null || user.password != password)
            {
                return(Content("账号或密码不正确!"));
            }

            Session["login_user"] = user;
            return(Redirect("/"));
        }
示例#2
0
文件: User.cs 项目: ZhaoQi99/EasyLife
 /// <summary>
 /// 得到一个用户对象实体
 /// </summary>
 public EasyLife.Model.User GetModel(string username)
 {
     return(dal.GetModel(username));
 }