Ejemplo n.º 1
0
        private void GetLoginAttemptsService()
        {
            while (true)
            {
                ITuple attempt = _loginAttempts.Get(typeof(string), typeof(string));
                Console.WriteLine("saw login request");
                var user = attempt[0] as string;
                var pass = attempt[1] as string;

                try
                {
                    SelectAccount(user); // don't remove, used to check whether account exists. Because accountExists(user) is hard
                    if (BoolFromRawPassAndUser(pass, user) && _loggedInUsers.QueryP(user) == null)
                    {
                        _loggedInUsers.Put(user);
                        _loginAttempts.Put(user, 1);
                        Console.WriteLine("server: deposited results succ");
                    }
                    else
                    {
                        _loginAttempts.Put(user, 0);
                        Console.WriteLine("server: deposited results fail");
                    }
                }
                catch (Exception)
                {
                    _loginAttempts.Put(user, 0);
                    Console.WriteLine("server: deposited results null");
                }
            }
        }