Explorar o código

add password confirmation for unlocking wallets.

Ugochukwu Mmaduekwe %!s(int64=7) %!d(string=hai) anos
pai
achega
4e8e5cd52c

+ 13 - 1
src/gui/wizards/operations/UWIZChangeKey_Confirmation.pas

@@ -32,6 +32,7 @@ type
     FChangeKeyGrid: TVisualGrid;
   public
     procedure OnPresent; override;
+    procedure OnNext; override;
     function Validate(out message: ansistring): boolean; override;
   end;
 
@@ -40,7 +41,7 @@ implementation
 
 {$R *.lfm}
 
-uses UAccounts, UCrypto, UDataSources, UCommon, UCommon.UI, Generics.Collections;
+uses UAccounts, UWallet, UUserInterface, UCrypto, UDataSources, UCommon, UCommon.UI, Generics.Collections;
 
 type
 
@@ -107,6 +108,17 @@ begin
   lblSgnAcc.Caption := TAccountComp.AccountNumberToAccountTxtNumber(Model.Signer.SignerAccount.account);
 end;
 
+procedure TWIZChangeKey_Confirmation.OnNext;
+var
+  locked: Boolean;
+begin
+  locked := (NOT TWallet.Keys.HasPassword) OR (NOT TWallet.Keys.IsValidPassword);
+  if locked then
+  begin
+    TUserInterface.UnlockWallet(Self);
+  end;
+end;
+
 function TWIZChangeKey_Confirmation.Validate(out message: ansistring): boolean;
 begin
   Result := True;

+ 13 - 1
src/gui/wizards/operations/UWIZSendPASC_Confirmation.pas

@@ -34,6 +34,7 @@ type
     FSendersGrid: TVisualGrid;
   public
     procedure OnPresent; override;
+    procedure OnNext; override;
     function Validate(out message: ansistring): boolean; override;
   end;
 
@@ -42,7 +43,7 @@ implementation
 
 {$R *.lfm}
 
-uses UAccounts, UDataSources, UCommon, UCommon.UI, Generics.Collections;
+uses UAccounts, UWallet, UUserInterface, UDataSources, UCommon, UCommon.UI, Generics.Collections;
 
 type
 
@@ -106,6 +107,17 @@ begin
   lblDestAcc.Caption := TAccountComp.AccountNumberToAccountTxtNumber(Model.SendPASC.DestinationAccount.account);
 end;
 
+procedure TWIZSendPASC_Confirmation.OnNext;
+var
+  locked: Boolean;
+begin
+  locked := (NOT TWallet.Keys.HasPassword) OR (NOT TWallet.Keys.IsValidPassword);
+  if locked then
+  begin
+    TUserInterface.UnlockWallet(Self);
+  end;
+end;
+
 function TWIZSendPASC_Confirmation.Validate(out message: ansistring): boolean;
 begin
   Result := True;