/// <summary> /// Inits the "Refresh security parameters" form. /// </summary> private void InitForm() { ctlAsyncLog.TitleText = GetString("macros.refreshsecurityparams.title"); // Init old salt text box if (chkRefreshAll.Checked) { txtOldSalt.Enabled = false; txtOldSalt.Text = GetString("macros.refreshsecurityparams.refreshalldescription"); } else { txtOldSalt.Enabled = true; } // Init new salt text box if (chkUseCurrentSalt.Checked) { txtNewSalt.Enabled = false; var customSalt = Service.Resolve <IAppSettingsService>()[ValidationHelper.APP_SETTINGS_HASH_STRING_SALT]; var resString = string.IsNullOrEmpty(customSalt) ? "macros.refreshsecurityparams.currentsaltisconnectionstring" : "macros.refreshsecurityparams.currentsaltiscustomvalue"; txtNewSalt.Text = GetString(resString); } else { txtNewSalt.Enabled = true; } // Init submit button btnRefreshSecurityParams.Text = GetString("macros.refreshsecurityparams"); btnRefreshSecurityParams.Click += (sender, args) => { var oldSaltInput = txtOldSalt.Text.Trim(); var newSaltInput = txtNewSalt.Text.Trim(); if (!chkRefreshAll.Checked && string.IsNullOrEmpty(oldSaltInput)) { ShowError(GetString("macros.refreshsecurityparams.oldsaltempty")); return; } if (!chkUseCurrentSalt.Checked && string.IsNullOrEmpty(newSaltInput)) { ShowError(GetString("macros.refreshsecurityparams.newsaltempty")); return; } pnlAsyncLog.Visible = true; var objectTypes = Functions.GetObjectTypesWithMacros(); RunAsync(delegate { LicenseCheckDisabler.ExecuteWithoutLicenseCheck(() => RefreshSecurityParams(objectTypes, oldSaltInput, newSaltInput, chkRefreshAll.Checked, chkUseCurrentSalt.Checked, AddLog)); }); }; }
/// <summary> /// Inits the "Refresh security parameters" form. /// </summary> private void InitForm() { // Init old salt text box if (chkRefreshAll.Checked) { txtOldSalt.Enabled = false; txtOldSalt.Text = GetString("macros.refreshsecurityparams.refreshalldescription"); } else { txtOldSalt.Enabled = true; } chkRefreshAll.CheckedChanged += (sender, args) => { // Clear the textbox after enabling it if (!chkRefreshAll.Checked) { txtOldSalt.Text = null; } }; // Init new salt text box if (chkUseCurrentSalt.Checked) { txtNewSalt.Enabled = false; var customSalt = SettingsHelper.AppSettings[ValidationHelper.APP_SETTINGS_HASH_STRING_SALT]; var resString = string.IsNullOrEmpty(customSalt) ? "macros.refreshsecurityparams.currentsaltisconnectionstring" : "macros.refreshsecurityparams.currentsaltiscustomvalue"; txtNewSalt.Text = GetString(resString); } else { txtNewSalt.Enabled = true; } chkUseCurrentSalt.CheckedChanged += chkUseCurrentSalt_CheckedChanged; // Init submit button btnRefreshSecurityParams.Text = GetString("macros.refreshsecurityparams"); btnRefreshSecurityParams.Click += (sender, args) => { var oldSaltInput = txtOldSalt.Text.Trim(); var newSaltInput = txtNewSalt.Text.Trim(); if (!chkRefreshAll.Checked && string.IsNullOrEmpty(oldSaltInput)) { ShowError(GetString("macros.refreshsecurityparams.oldsaltempty")); return; } if (!chkUseCurrentSalt.Checked && string.IsNullOrEmpty(newSaltInput)) { ShowError(GetString("macros.refreshsecurityparams.newsaltempty")); return; } pnlAsyncLog.Visible = true; var objectTypes = Functions.GetObjectTypesWithMacros(); RunAsync(EVENTLOG_SOURCE_REFRESHSECURITYPARAMS, delegate { LicenseCheckDisabler.ExecuteWithoutLicenseCheck(() => RefreshSecurityParams(objectTypes, oldSaltInput, newSaltInput)); }); }; }