static bool IsValidLoginAccount(string name, string pw) { const string loginFile = "login.txt"; if (!File.Exists(loginFile)) { ConsoleScreen.ShowError("Bad Config", "login.txt file could not be found. Please place into the program directory."); Environment.Exit(-1); } return(File.ReadLines(loginFile).Contains(name + "|" + pw)); // No salts & hashes here }
static void Login() { while (true) { var screen = new ConsoleScreen(Art.AsHeader(Title, Art.BitCoin)); screen.AddText("Login to start"); screen.AddBlankLines(); var username = screen.AddInput("User name: ", Validate.AsString()); var password = screen.AddPassword("Password: "******"Login Error", "Username-password combination was not valid."); } }
static void Deposit(Bank bank) { var screen = new ConsoleScreen("Deposit"); screen.AddText("Enter the details", TextJustification.Center); var account = screen.AddInput("Account Number: ", Validate.AsAccount(bank)); var deposit = screen.AddInput("Amount: $", Validate.Money()); if (screen.Show()) { if ((account.Response.Balance + deposit.Response) <= Bank.MaxAccountBalance) { bank.Transact(account.Response, deposit.Response); ShowSuccess(account.Response); } else { ConsoleScreen.ShowError("Balance too high", "Sorry, our insurance provider will not allow us to store that much money for one individual. We recommend purchasing a vault from one of our competitors."); } } }