예제 #1
0
        public User Auth(string loginField, string pwd)
        {
            User u = FindByLoginField(loginField);

            if (u != null && u.pwd == MD5Helper.Encryt(string.Format("{0}{1}", pwd, u.pwdSalt)))
            {
                return(u);
            }
            return(null);
        }
예제 #2
0
        public bool Create(User user)
        {
            //ICarTypeRepository rep = new CarTypeRepository(this.Context, this.User);
            user.pwdSalt = user.GenSalt();
            user.pwd     = MD5Helper.Encryt(string.Format("{0}{1}", user.pwd, user.pwdSalt));
            rep.Create(user);

            this.Context.SaveAll();
            return(true);
            //throw new NotImplementedException();
        }