|
37 | 37 |
|
38 | 38 | namespace VeraCrypt
|
39 | 39 | {
|
40 |
| - class AdminPasswordRequestHandler : public GetStringFunctor |
41 |
| - { |
42 |
| - public: |
43 |
| - virtual void operator() (string &passwordStr) |
44 |
| - { |
45 |
| - |
46 |
| - wxString sValue; |
47 |
| - if (Gui->GetWaitDialog()) |
48 |
| - { |
49 |
| - Gui->GetWaitDialog()->RequestAdminPassword(sValue); |
50 |
| - if (sValue.IsEmpty()) |
51 |
| - throw UserAbort (SRC_POS); |
52 |
| - } |
53 |
| - else |
54 |
| - { |
55 |
| - wxPasswordEntryDialog dialog (Gui->GetActiveWindow(), LangString["LINUX_ADMIN_PW_QUERY"], LangString["LINUX_ADMIN_PW_QUERY_TITLE"]); |
56 |
| - if (dialog.ShowModal() != wxID_OK) |
57 |
| - throw UserAbort (SRC_POS); |
58 |
| - sValue = dialog.GetValue(); |
59 |
| - } |
60 |
| - wstring wPassword (sValue); // A copy of the password is created here by wxWidgets, which cannot be erased |
61 |
| - finally_do_arg (wstring *, &wPassword, { StringConverter::Erase (*finally_arg); }); |
62 |
| - |
63 |
| - StringConverter::ToSingle (wPassword, passwordStr); |
64 |
| - } |
65 |
| - }; |
66 |
| - |
67 | 40 | #ifdef TC_MACOSX
|
68 | 41 | int GraphicUserInterface::g_customIdCmdV = 0;
|
69 | 42 | int GraphicUserInterface::g_customIdCmdA = 0;
|
@@ -479,6 +452,32 @@ namespace VeraCrypt
|
479 | 452 |
|
480 | 453 | shared_ptr <GetStringFunctor> GraphicUserInterface::GetAdminPasswordRequestHandler ()
|
481 | 454 | {
|
| 455 | + class AdminPasswordRequestHandler : public GetStringFunctor |
| 456 | + { |
| 457 | + public; |
| 458 | + virtual void operator() (string &passwordStr) |
| 459 | + { |
| 460 | + |
| 461 | + wxString sValue; |
| 462 | + if (Gui->GetWaitDialog()) |
| 463 | + { |
| 464 | + Gui->GetWaitDialog()->RequestAdminPassword(sValue); |
| 465 | + if (sValue.IsEmpty()) |
| 466 | + throw UserAbort (SRC_POS); |
| 467 | + } |
| 468 | + else |
| 469 | + { |
| 470 | + wxPasswordEntryDialog dialog (Gui->GetActiveWindow(), LangString["LINUX_ADMIN_PW_QUERY"], LangString["LINUX_ADMIN_PW_QUERY_TITLE"]); |
| 471 | + if (dialog.ShowModal() != wxID_OK) |
| 472 | + throw UserAbort (SRC_POS); |
| 473 | + sValue = dialog.GetValue(); |
| 474 | + } |
| 475 | + wstring wPassword (sValue); // A copy of the password is created here by wxWidgets, which cannot be erased |
| 476 | + finally_do_arg (wstring *, &wPassword, { StringConverter::Erase (*finally_arg); }); |
| 477 | + |
| 478 | + StringConverter::ToSingle (wPassword, passwordStr); |
| 479 | + } |
| 480 | + }; |
482 | 481 | return shared_ptr <GetStringFunctor> (new AdminPasswordRequestHandler);
|
483 | 482 | }
|
484 | 483 |
|
|
0 commit comments