mirror of https://github.com/OpenVPN/openvpn-gui
In User-Auth dialog require non-empty password or PIN
We had earlier supported blank passwords or OTPs to be submitted. Change this by enabling the OK button only if some minimal inputs are present. - In static challenge dialog require username and either password or challenge-reponse (OTP) fields to be non-empty - In normal user-auth dialog require username and password to be non-empty Signed-off-by: Selva Nair <selva.nair@gmail.com>pull/420/head
parent
0511236062
commit
e4252076cf
15
openvpn.c
15
openvpn.c
|
@ -519,18 +519,21 @@ UserAuthDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
case ID_EDT_AUTH_USER:
|
case ID_EDT_AUTH_USER:
|
||||||
|
case ID_EDT_AUTH_PASS:
|
||||||
|
case ID_EDT_AUTH_CHALLENGE:
|
||||||
if (HIWORD(wParam) == EN_UPDATE)
|
if (HIWORD(wParam) == EN_UPDATE)
|
||||||
{
|
{
|
||||||
int len = Edit_GetTextLength((HWND) lParam);
|
/* enable OK button only if username and either password or response are filled */
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDOK), (len ? TRUE : FALSE));
|
BOOL enableOK = GetWindowTextLength(GetDlgItem(hwndDlg, ID_EDT_AUTH_USER))
|
||||||
|
&& (GetWindowTextLength(GetDlgItem(hwndDlg, ID_EDT_AUTH_PASS))
|
||||||
|
|| ((param->flags & FLAG_CR_TYPE_SCRV1)
|
||||||
|
&& GetWindowTextLength(GetDlgItem(hwndDlg, ID_EDT_AUTH_CHALLENGE)))
|
||||||
|
);
|
||||||
|
EnableWindow(GetDlgItem(hwndDlg, IDOK), enableOK);
|
||||||
}
|
}
|
||||||
AutoCloseCancel(hwndDlg); /* user interrupt */
|
AutoCloseCancel(hwndDlg); /* user interrupt */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_EDT_AUTH_PASS:
|
|
||||||
AutoCloseCancel(hwndDlg); /* user interrupt */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_CHK_SAVE_PASS:
|
case ID_CHK_SAVE_PASS:
|
||||||
param->c->flags ^= FLAG_SAVE_AUTH_PASS;
|
param->c->flags ^= FLAG_SAVE_AUTH_PASS;
|
||||||
if (param->c->flags & FLAG_SAVE_AUTH_PASS)
|
if (param->c->flags & FLAG_SAVE_AUTH_PASS)
|
||||||
|
|
Loading…
Reference in New Issue