private void CheckPreviousPassword() { //39, 21 - 23 Station.writerClearedRow(39, 21, "Enter previous password"); Station.clearRow(1, 23, 118); Console.CursorVisible = true; Console.SetCursorPosition(39, 22); string prevPassword = Station.PassWordStar(); if (prevPassword == Station.password) { Station.writerClearedRow(39, 24, "Enter New User Name"); newUsername = Station.MeteredInput(12, 39, 25); Station.writerClearedRow(39, 27, "Enter New Password"); Console.SetCursorPosition(39, 28); newPassword = Station.PassWordStar(); Station.writerClearedRow(39, 30, "Confirm New Password"); Console.SetCursorPosition(39, 31); string newPasswordConfirm = Station.PassWordStar(); if (newPassword == newPasswordConfirm) { Station.writerClearedRow(39, 33, "Press (Y) to save or (N) to cancel"); Console.CursorVisible = false; ConsoleKeyInfo key1; key1 = Console.ReadKey(true); if (key1.Key == ConsoleKey.Y) { SaveToSettingsFile(); SettingsLoginDetails sld = new SettingsLoginDetails(); sld.Start(); } else if (key1.Key == ConsoleKey.N) { Station.writerClearedRow(39, 35, "Change Login Details Canceled"); Station.writerClearedRow(39, 36, "Press any key to exit"); Console.ReadKey(true); SettingsLoginDetails sld = new SettingsLoginDetails(); sld.Start(); } else { Station.BeepError(); Console.SetCursorPosition(39, 36); Console.WriteLine("Invalid Key."); Thread.Sleep(200); Station.clearRow(39, 36, 15); } } else { Console.CursorVisible = false; Station.writerClearedRow(39, 34, "The Passwords Do not Match"); Station.writerClearedRow(39, 35, "press anykey to try again"); Console.ReadKey(true); Start(); } } else { Console.CursorVisible = false; Station.writerClearedRow(39, 24, "The Password is Incorrect"); Station.writerClearedRow(39, 25, "press anykey to try again"); Console.ReadKey(true); Start(); } }
public void DisplayPassword() { Console.ForegroundColor = Station.consoleColMain; Console.Clear(); Border(5, 42, 35, 30); int left = 50; int top = 10; Console.SetCursorPosition(left, top); Console.WriteLine(" Login Page "); top++; Console.SetCursorPosition(left, top); Console.WriteLine("---------------"); top += 2; Console.SetCursorPosition(left, top); Console.WriteLine("Enter your Username"); top++; Console.SetCursorPosition(left, top); string username = Station.MeteredInput(12, left, top); top += 2; Console.SetCursorPosition(left, top); Console.WriteLine("Enter your Password"); string password = ""; if (Station.passHide == "A") { top++; Console.SetCursorPosition(left, top); password = Station.PassWordStar(); } else if (Station.passHide == "I") { top++; Console.SetCursorPosition(left, top); Console.ForegroundColor = ConsoleColor.Black; password = Station.MeteredInput(12, left, top); Console.ForegroundColor = Station.consoleColMain; } if (username == Station.username && password == Station.password) { Station.loggedIn = true; Console.SetCursorPosition(left, top + 5); Console.WriteLine("you have Logged in"); Console.CursorVisible = false; Console.SetCursorPosition(left, top + 3); Console.WriteLine("Press any key to continue"); Console.ReadKey(true); MainMenu mm = new MainMenu(); mm.Start(); } else { Console.SetCursorPosition(left, top + 5); Console.WriteLine("Login incorrect"); top += 2; Console.SetCursorPosition(left, top + 5); Console.WriteLine("Press any key"); top++; Console.SetCursorPosition(left, top + 5); Console.WriteLine("to try again"); Console.CursorVisible = false; Console.ReadKey(true); DisplayPassword(); } }