1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 19:08:26 -06:00

MacOSX: Add PIM value validity checks to workaround wxWidget bug that makes wxTextValidator useless when applied to a text control with password attribute (http://trac.wxwidgets.org/ticket/17185).

This commit is contained in:
Mounir IDRASSI
2016-01-25 01:35:17 +01:00
parent e9d3ba0b11
commit b8a2e808c6
5 changed files with 50 additions and 5 deletions

20
src/Main/Forms/ChangePasswordDialog.cpp Normal file → Executable file
View File

@@ -92,6 +92,12 @@ namespace VeraCrypt
Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
return;
}
int currentPim = CurrentPasswordPanel->GetVolumePim();
if (-1 == currentPim)
{
CurrentPasswordPanel->SetFocusToPimTextCtrl();
return;
}
shared_ptr <VolumePassword> newPassword;
int newPim = 0;
@@ -108,6 +114,11 @@ namespace VeraCrypt
return;
}
newPim = NewPasswordPanel->GetVolumePim();
if (-1 == newPim)
{
NewPasswordPanel->SetFocusToPimTextCtrl();
return;
}
if (newPassword->Size() > 0)
{
@@ -224,6 +235,9 @@ namespace VeraCrypt
if (passwordEmpty && keyfilesEmpty)
ok = false;
if (CurrentPasswordPanel->GetVolumePim () == -1)
ok = false;
if (DialogMode == Mode::RemoveAllKeyfiles && (passwordEmpty || keyfilesEmpty))
ok = false;
@@ -237,7 +251,11 @@ namespace VeraCrypt
ok = false;
if (DialogMode == Mode::ChangePasswordAndKeyfiles
&& ((NewPasswordPanel->GetPassword()->IsEmpty() && newKeyfilesEmpty) || !NewPasswordPanel->PasswordsMatch()))
&& ( (NewPasswordPanel->GetPassword()->IsEmpty() && newKeyfilesEmpty)
|| !NewPasswordPanel->PasswordsMatch()
|| (NewPasswordPanel->GetVolumePim() == -1)
)
)
ok = false;
}
}