Example #1
0
        // function that authenticates user
        public void Login()
        {
            Console.Write("Enter your username: "******"Enter your password: "******"Logged in : " + username);
                new AccountScreen(res.UserId, res.AuthKey).Run();
                return;
            }
            else
            {
                Console.WriteLine("Error : " + res.Errors);
                Login();
                return;
            }
        }
Example #2
0
        // function that registers new user
        public void Register()
        {
            Console.Write("Enter your username: "******"Enter your password: "******"Re-enter your password: "******"Passwords not matched.");
                Register();
                return;
            }

            var user = new User
            {
                Username = username,
                Password = pass
            };

            var res = new AuthService().Register(user);

            if (res.Success)
            {
                Console.WriteLine("Registered : " + username);

                new LoginScreen().Run(false);
                return;
            }
            else
            {
                Console.WriteLine("Error : " + res.Errors);
                Register();
                return;
            }
        }