예제 #1
0
파일: AccountBL.cs 프로젝트: nzysoft/Loger
        public Tuple <string, int> CheckUser(Login user)
        {
            // Converting (encrypt) user plain text password into hashed
            byte[] data = Encoding.ASCII.GetBytes(user.Password);
            data          = new SHA256Managed().ComputeHash(data);
            user.Password = Encoding.ASCII.GetString(data);

            List <User> usersInfo = _accountDA.GetLoginUsers(user);

            if (usersInfo.Count == 1)
            {
                return(new Tuple <string, int>("success", usersInfo.ElementAt(0).ID));
            }
            else
            {
                return(new Tuple <string, int>("fail", -1));
            }
        }