private void PromptSetServerPassword() { var password = FeenPhone.Accounting.PasswordOnlyRepo.RequirePassword; if (LoginPassWindow.Prompt(ref password, "Set Server Password.", "Set Pass")) { SetServerPassword(password); } else { if (password == null) { RequireAuth = false; } else { Console.WriteLine("Server password unchanged."); } } }
private void InvokeLoginEvent(LoginStatusEventArgs e) { UserListWPF.DisableAudioAlertForDuration(5.0); bool isLoggedIn = e.isLoggedIn; int version = e.version; string message = e.message; if (message != null) { Console.WriteLine(message); } var client = Client; if (!isLoggedIn && client != null && client.IsConnected) { Console.WriteLine("Server requests login."); if (invalidLoginAttempts == 0) { invalidLoginAttempts++; client.SendLoginInfo(); } else { invalidLoginAttempts++; if (version >= 1) { var pass = client.Password; if (LoginPassWindow.Prompt(password: ref pass, message: message) && !string.IsNullOrWhiteSpace(pass)) { Password = client.Password = pass; client.SendLoginInfo(); invalidLoginAttempts = 0; } else { Console.WriteLine("Server login canceled."); client.Dispose(); if (Client == client) { Client = null; } } } else { Console.WriteLine("Server login rejected."); client.Dispose(); if (Client == client) { Client = null; } } } } else { Console.WriteLine("Server login accepted."); invalidLoginAttempts = 0; } }