From 12895f7774676fba5a0987e1a6f1d4e852ff316b Mon Sep 17 00:00:00 2001 From: Mihaela Stoica Date: Wed, 23 Sep 2015 13:26:45 +0100 Subject: [PATCH] CP-13985: "Test Credentails" button on Health Check dialog - changes following code review - Button enabled only when "New XS credentials" radio button is ticked and username and password textboxes are not empty - Button and the textboxes are disabled while the test is in progress - When test credentials fails, log userName, not UserDisplayName Signed-off-by: Mihaela Stoica --- XenAdmin/Dialogs/HealthCheck/HealthCheckSettingsDialog.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/XenAdmin/Dialogs/HealthCheck/HealthCheckSettingsDialog.cs b/XenAdmin/Dialogs/HealthCheck/HealthCheckSettingsDialog.cs index ee2f23d7f..9e7df390e 100644 --- a/XenAdmin/Dialogs/HealthCheck/HealthCheckSettingsDialog.cs +++ b/XenAdmin/Dialogs/HealthCheck/HealthCheckSettingsDialog.cs @@ -204,6 +204,8 @@ namespace XenAdmin.Dialogs.HealthCheck private void radioButton2_CheckedChanged(object sender, EventArgs e) { SetXSCredentials(currentXsCredentialsRadioButton.Checked); + testCredentialsButton.Enabled = newXsCredentialsRadioButton.Checked && + !string.IsNullOrEmpty(textboxXSUserName.Text) && !string.IsNullOrEmpty(textboxXSPassword.Text); } private void SetXSCredentials(bool useCurrent) @@ -353,11 +355,13 @@ namespace XenAdmin.Dialogs.HealthCheck ShowTestCredentialsStatus(Resources._000_Tick_h32bit_16, null); else ShowTestCredentialsStatus(Resources._000_error_h32bit_16, action.Exception != null ? action.Exception.Message : Messages.HEALTH_CHECK_USER_NOT_AUTHORIZED); + textboxXSUserName.Enabled = textboxXSPassword.Enabled = testCredentialsButton.Enabled = newXsCredentialsRadioButton.Checked; }); }; log.Debug("Testing logging in with the new credentials"); ShowTestCredentialsStatus(Resources.ajax_loader, null); + textboxXSUserName.Enabled = textboxXSPassword.Enabled = testCredentialsButton.Enabled = false; action.RunAsync(); } @@ -382,11 +386,11 @@ namespace XenAdmin.Dialogs.HealthCheck { if (authorizedRoles.Contains(r)) { - log.DebugFormat("Subject '{0}' is authorized to complete the action", ud.UserDisplayName ?? ud.UserName ?? ud.UserSid); + log.DebugFormat("Subject '{0}' is authorized to complete the action", ud.UserName ?? ud.UserSid); return true; } } - log.DebugFormat("Subject '{0}' is not authorized to complete the action", ud.UserDisplayName ?? ud.UserName ?? ud.UserSid); + log.DebugFormat("Subject '{0}' is not authorized to complete the action", ud.UserName ?? ud.UserSid); return false; } }