// Objects of class types //public UserPass UnP_Pair; public void CheckUserPass() { UserPass UnPPair = new UserPass(); string userAuth = ""; string passAuth = ""; Console.WriteLine("Enter User Name to be Authenticated:"); userAuth = Console.ReadLine(); Console.WriteLine("Enter Password to be Authenticated:"); passAuth = Console.ReadLine(); if (UnPPair.usersList.Contains(userAuth) && (UnPPair.passList.Contains(passAuth))) { Console.WriteLine("authenticated"); Console.WriteLine("Press Enter to Return to Main Menu"); } else { Console.WriteLine("Not Authorized"); } Console.WriteLine("Press Enter to Return to Main Menu"); Console.ReadLine(); }
// Handles main navigation from the user bool ElicitUserInput() { bool quit = false; bool isValid = false; //public Menu mainMenu; do { try { Console.Write("Please select an option:"); int choice = int.Parse(Console.ReadLine()); Console.Clear(); isValid = true; switch (choice) { case 1: UserPass UnP = new UserPass(); UnP.GetUnameAndPass(); //[x]Write a user interface that gives the user three options. Option 1 is to create an account by entering a username and a password. break; case 2: AuthUser authPass = new AuthUser(); authPass.CheckUserPass(); //[ ]authenticate a user by entering a username and password break; case 3: Console.WriteLine("Exit"); quit = true; break; //[ ]Upon exit, the application will print all username/password pairs previously entered. default: isValid = false; Console.WriteLine("Selection must be 1, 2, or 3. Try again!"); break; } } catch (FormatException) { isValid = false; } }while (!quit && !isValid); return(quit); }