mirror of https://github.com/OpenVPN/openvpn-gui
Handle state change message when repsonse is not required
Currently we show a messagebox with OK/CANCEL when response is not required but that cannot handle state change messages. Instead, show the "GenericPass" dialog with input disabled. Signed-off-by: Selva Nair <selva.nair@gmail.com>pull/443/head
parent
131c75e560
commit
e6e65a4883
25
openvpn.c
25
openvpn.c
|
@ -660,19 +660,6 @@ GenericPassDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
SetDlgItemTextW(hwndDlg, ID_TXT_DESCRIPTION, wstr);
|
||||
|
||||
/* If response is not required show a message box with the challenge
|
||||
* text and autosubmit an empty password (see management-notes.txt)
|
||||
*/
|
||||
if ((param->flags & FLAG_CR_RESPONSE) == 0)
|
||||
{
|
||||
wchar_t title[256];
|
||||
GetWindowTextW(hwndDlg, title, _countof(title));
|
||||
if (MessageBoxExW(NULL, wstr, title, MB_OKCANCEL|MB_SETFOREGROUND|MB_TOPMOST, GetGUILanguage()) == IDOK)
|
||||
SimulateButtonPress(hwndDlg, IDOK);
|
||||
else
|
||||
SimulateButtonPress(hwndDlg, IDCANCEL);
|
||||
}
|
||||
|
||||
/* Set password echo on if needed */
|
||||
if (param->flags & FLAG_CR_ECHO)
|
||||
SendMessage(GetDlgItem(hwndDlg, ID_EDT_RESPONSE), EM_SETPASSWORDCHAR, 0, 0);
|
||||
|
@ -695,8 +682,18 @@ GenericPassDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
else
|
||||
SetForegroundWindow(hwndDlg);
|
||||
|
||||
/* disable OK button by default - not disabled in resources */
|
||||
/* If response is not required hide the response field */
|
||||
if ((param->flags & FLAG_CR_TYPE_CRV1 || param->flags & FLAG_CR_TYPE_CRTEXT)
|
||||
&& !(param->flags & FLAG_CR_RESPONSE))
|
||||
{
|
||||
ShowWindow(GetDlgItem(hwndDlg, ID_LTEXT_RESPONSE), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwndDlg, ID_EDT_RESPONSE), SW_HIDE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* disable OK button until response is filled-in */
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue