Beispiel #1
0
        public bool Login(string userName, string password)
        {
            if (string.IsNullOrWhiteSpace(userName))
            {
                throw new Exception("用户名不能为空");
            }

            if (string.IsNullOrWhiteSpace(password))
            {
                throw new Exception("密码不能为空");
            }

            //if (MD5Helper.MD5Encrypt64(password).Equals(centerUser.password))
            var credential = new OrderCredential()
            {
                Name     = userName,
                Password = password
            };

            var userId = _userController.Login(credential);

            _cache.Add <long>(SessionConstant.USER_ID, userId);

            return(true);
        }
        public override long Login(OrderCredential credential)
        {
            var users = _userLogic.GetUsers(credential.Name);
            var user  = users.Where(u => u.Password == credential.Password).ToArray();

            if (user == null || user.Length == 0)
            {
                throw new Exception("用户名或密码不正确!");
            }

            //_cache.Add<long>(SessionConst.USER_ID, user[0].ID);


            return(user[0].ID);
        }
Beispiel #3
0
 public abstract long Login(OrderCredential credential);