public bool IsPasswordValid(IEmailAndPassword User)
        {
            List <User> list = this.User.Where(u => u.Email == User.Email).ToList();

            if (!list.Any())
            {
                throw new ArgumentException($"No user exists with email {User.Email}");
            }

            return(list.Any(u => u.Password == User.Password));
        }
Example #2
0
 public bool IsPasswordValid(IEmailAndPassword User)
 {
     throw new NotImplementedException();
 }
        public static bool IsUserPasswordCorrect(IEnumerable <IEmailAndPassword> DataSet, IEmailAndPassword User)
        {
            List <byte[]> PasswordsForUserName = DataSet.Where(DataSetUser => DataSetUser.Email == User.Email)
                                                 .Select(DataSetUser => DataSetUser.Password)
                                                 .ToList();

            if (!PasswordsForUserName.Any())
            {
                throw new ArgumentException($"No user exists with user name {User.Email}");
            }

            return(PasswordsForUserName.Any(pw => pw.SequenceEqual(User.Password)));
        }