Skip to content

Commit 4ad42fc

Browse files
UI: use password fields for EAB key and Account Key
1 parent b1ed323 commit 4ad42fc

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

src/Certify.UI.Shared/Windows/EditAccountDialog.xaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,12 @@
172172
Margin="0,0,8,0"
173173
VerticalAlignment="Top"
174174
Content="Key (HMAC)" />
175-
<TextBox
175+
<PasswordBox
176+
x:Name="EabKey"
176177
Width="300"
177178
Height="23"
178179
HorizontalAlignment="Left"
179-
VerticalAlignment="Top"
180-
Text="{Binding Item.EabKey}"
181-
TextWrapping="NoWrap" />
180+
VerticalAlignment="Top" />
182181
</StackPanel>
183182
<StackPanel
184183
Margin="0,0,0,4"
@@ -228,15 +227,12 @@
228227
Margin="0,0,8,0"
229228
VerticalAlignment="Top"
230229
Content="Account Key" />
231-
<TextBox
230+
<PasswordBox
232231
x:Name="AccountKey"
233232
Width="300"
234233
Height="48"
235234
HorizontalAlignment="Left"
236-
VerticalAlignment="Top"
237-
AcceptsReturn="True"
238-
Text="{Binding Item.ImportedAccountKey}"
239-
TextWrapping="Wrap" />
235+
VerticalAlignment="Top" />
240236

241237

242238
</StackPanel>

src/Certify.UI.Shared/Windows/EditAccountDialog.xaml.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
using System.Linq;
55
using System.Text.RegularExpressions;
66
using System.Windows;
7-
using System.Windows.Controls;
8-
using System.Windows.Data;
97
using System.Windows.Input;
108
using Certify.Models;
119
using Org.BouncyCastle.Crypto.EC;
@@ -102,6 +100,17 @@ private async void Save_Click(object sender, RoutedEventArgs e)
102100
}
103101
}
104102

103+
// use password fields (account key and eab key) if set
104+
if (!string.IsNullOrWhiteSpace(EabKey.Password))
105+
{
106+
Item.EabKey = EabKey.Password;
107+
}
108+
109+
if (!string.IsNullOrWhiteSpace(AccountKey.Password))
110+
{
111+
Item.ImportedAccountKey = AccountKey.Password;
112+
}
113+
105114
// if EAB is required and not importing an existing account, show CA specific instructions or general prompt for EAB
106115
if (ca.RequiresExternalAccountBinding && (string.IsNullOrEmpty(Item.ImportedAccountKey) || string.IsNullOrEmpty(Item.ImportedAccountURI)))
107116
{
@@ -191,7 +200,7 @@ private void AccountKeyGenerate_Click(object sender, RoutedEventArgs e)
191200

192201
Item.ImportedAccountKey = pem;
193202

194-
BindingOperations.GetBindingExpressionBase((TextBox)AccountKey, TextBox.TextProperty).UpdateTarget();
203+
AccountKey.Password = pem;
195204
}
196205
}
197206
}

0 commit comments

Comments
 (0)