Skip to content

Commit 077e8d7

Browse files
committed
Use secure desktop when asking for SoftLock pin
If "Enter master key on secure desktop" is active, secure desktop is also used by SoftLock
1 parent 1d27d48 commit 077e8d7

File tree

3 files changed

+32
-18
lines changed

3 files changed

+32
-18
lines changed

src/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[assembly: AssemblyConfiguration("")]
1111
[assembly: AssemblyCompany("Rookiestyle")]
1212
[assembly: AssemblyProduct("KeePass Plugin")]
13-
[assembly: AssemblyCopyright("Copyright © 2021-2023")]
13+
[assembly: AssemblyCopyright("Copyright © 2021-2024")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
1616

@@ -32,5 +32,5 @@
3232
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
3333
// indem Sie "*" wie unten gezeigt eingeben:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("3.5")]
36-
[assembly: AssemblyFileVersion("3.5")]
35+
[assembly: AssemblyVersion("3.6")]
36+
[assembly: AssemblyFileVersion("3.6")]

src/SoftLock.cs

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -197,22 +197,36 @@ private void OnTimerTick(object sender, EventArgs e)
197197

198198
private void DisableSoftlockUsingQU()
199199
{
200-
m_UnlockForm = new UnlockForm();
201-
m_UnlockForm.Text = PluginTranslate.PluginName + " - Softlock";
202-
if (m_UnlockForm.ShowDialog(Program.MainForm) == DialogResult.OK)
200+
if (m_UnlockForm != null) m_UnlockForm.Dispose();
201+
202+
KeePassLib.Delegates.GFunc<UnlockForm> fConstruct = delegate()
203203
{
204-
ProtectedString CheckQuickUnlockKey = m_UnlockForm.QuickUnlockKey;
205-
ProtectedString QuickUnlockKey = _qu.GetQuickUnlockKey(Program.MainForm.ActiveDatabase);
206-
var lac = LockAssistConfig.GetQuickUnlockOptions(Program.MainForm.ActiveDatabase);
207-
if ((QuickUnlockKey == null) || CheckQuickUnlockKey.Equals(_qu.TrimQuickUnlockKey(QuickUnlockKey, lac), false))
208-
{
209-
SetVisibility(true);
210-
if (LockAssistConfig.SL_IsActive) m_SLTimer.Interval = LockAssistConfig.SL_Seconds * 1000;
211-
}
212-
else PluginDebug.AddError("Deactivate SoftLock", "Deactivation failed", "Invalid Quick Unlock key provided");
204+
m_UnlockForm = new UnlockForm();
205+
m_UnlockForm.Text = PluginTranslate.PluginName + " - Softlock";
206+
return m_UnlockForm;
207+
};
208+
209+
KeePassLib.Delegates.GFunc<UnlockForm, ProtectedString> fResultBuilder = delegate(UnlockForm f)
210+
{
211+
ProtectedString r = f.QuickUnlockKey;
212+
UIUtil.DestroyForm(m_UnlockForm);
213+
m_UnlockForm = null;
214+
return r;
215+
};
216+
217+
ProtectedString psCheckQuickUnlockKey = new ProtectedString();
218+
DialogResult dr = Tools.ShowDialog(Program.Config.Security.MasterKeyOnSecureDesktop, fConstruct, fResultBuilder, out psCheckQuickUnlockKey);
219+
220+
if (dr != DialogResult.OK) return;
221+
222+
ProtectedString psQuickUnlockKey = _qu.GetQuickUnlockKey(Program.MainForm.ActiveDatabase);
223+
var lacOptions = LockAssistConfig.GetQuickUnlockOptions(Program.MainForm.ActiveDatabase);
224+
if ((psQuickUnlockKey == null) || psCheckQuickUnlockKey.Equals(_qu.TrimQuickUnlockKey(psQuickUnlockKey, lacOptions), false))
225+
{
226+
SetVisibility(true);
227+
if (LockAssistConfig.SL_IsActive) m_SLTimer.Interval = LockAssistConfig.SL_Seconds * 1000;
213228
}
214-
if (m_UnlockForm != null) m_UnlockForm.Dispose();
215-
m_UnlockForm = null;
229+
else PluginDebug.AddError("Deactivate SoftLock", "Deactivation failed", "Invalid Quick Unlock key provided");
216230
}
217231

218232
private void DisableSoftlockUsingFullPassword()

version.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
:
2-
LockAssist:3.5
2+
LockAssist:3.6
33
LockAssist!de:5
44
LockAssist!pt:4
55
LockAssist!zh:5

0 commit comments

Comments
 (0)