Пример #1
0
        private static void AuthenticateAccount()
        {
            Console.Clear();

            Console.WriteLine("Enter your username: "******"Enter your password: "******"\nAccount does not exist. Press enter to try again. ");
                Console.ReadLine();
                AuthenticateAccount();
            }

            string encryptedPassword = EncyptPassword.MD5Hash(password);

            accountList.TryGetValue(userName, out password);
            if (accountList.TryGetValue(userName, out password) && password == encryptedPassword)
            {
                Console.WriteLine("\nAccount has been authenticated");
                Console.WriteLine("Press enter to return to the main menu.");
                Console.ReadLine();
                UserInterface();
            }
            else
            {
                Console.WriteLine("\nIncorrect Username or Password. Press enter to try again.");
                Console.ReadLine();
                AuthenticateAccount();
            }
        }
Пример #2
0
        private static void CreateNewAccount()
        {
            Console.Clear();

            Console.WriteLine("Enter your username: "******"Username has been taken. Press enter to start again.");
                Console.ReadLine();
                CreateNewAccount();
            }

            Console.WriteLine("Enter your password: "******"Username: {userName}\n" +
                              $"Password: {password}\n" +
                              $"Encrypted Password: {encryptedPassword}");

            Console.WriteLine("\nPress any key to return to the menu.");
            Console.ReadLine();
            UserInterface();
        }