Skip to content

Commit 8a9c0f1

Browse files
Fix pref saving (model validation)
1 parent a15e663 commit 8a9c0f1

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Certify.UI.Shared/Controls/Settings/General.xaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@
165165
Margin="0,4,0,0"
166166
Content="Enable Modern PFX Alg (OpenSSL 3.0+ compatibility etc)"
167167
IsChecked="{Binding Prefs.UseModernPFXAlgs}" />
168+
<CheckBox
169+
x:Name="DisableARIChecks"
170+
Margin="0,4,0,0"
171+
Content="Disable ACME ARI (don't use renewal dates suggested by CA)"
172+
IsChecked="{Binding Prefs.DisableARIChecks}" />
168173

169174
</StackPanel>
170175

src/Certify.UI.Shared/ViewModel/AppViewModel/AppViewModel.Settings.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Linq;
55
using System.Threading;
66
using System.Threading.Tasks;
7+
using System.Windows;
78
using Certify.Client;
89
using Certify.Models;
910
using Certify.Models.Config.Migration;
@@ -132,8 +133,25 @@ public virtual async Task SavePreferences()
132133
await _prefLock.WaitAsync(500);
133134
try
134135
{
136+
// set datastoreid and feature flags to pass model validation
137+
if (Preferences.ConfigDataStoreConnectionId == null)
138+
{
139+
Preferences.ConfigDataStoreConnectionId = "0";
140+
}
141+
142+
if (Preferences.FeatureFlags == null)
143+
{
144+
145+
Preferences.FeatureFlags = [];
146+
}
147+
135148
await _certifyClient.SetPreferences(Preferences);
136149
}
150+
catch (ServiceCommsException ex)
151+
{
152+
MessageBox.Show($"Unable to save preferences. {ex?.Message}.", "Save Preferences Error", MessageBoxButton.OK, MessageBoxImage.Error);
153+
154+
}
137155
catch
138156
{
139157
Debug.WriteLine("Pref wait lock exceeded");

0 commit comments

Comments
 (0)