Rationale for password field focus

From: Aaron Spike <spikeac(at)mlc-wels(dot)edu>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Rationale for password field focus
Date: 2021-04-26 14:40:00
Message-ID: CABcA21QKRkouq26603_S+1BwODkSoECsb3N9oRw1Zx6C1Q0gFQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

We've noticed that the password field on the PostgreSQL Connection dialog
is always focused when empty, even when other fields that appear earlier on
the dialog (and in the tab order) are empty. This is only a minor
annoyance, but it does seem like it would be contrary to the expectation of
most users. The related commit messages don't provide much information
about why this was done. Can anyone share the rationale for the current
behavior?

For the purpose of discussion, I would propose separating the conditional
to inform the user that the password is required, but still focus the first
empty field. (Please see the diff below.)

Aaron Spike

diff --git a/drvconn.c b/drvconn.c
index 7224c17..76586b8 100644
--- a/drvconn.c
+++ b/drvconn.c
@@ -390,12 +390,11 @@ dconn_FDriverConnectProc(
{
HWND notu = GetDlgItem(hdlg,
IDC_NOTICE_USER);

- SetFocus(GetDlgItem(hdlg, IDC_PASSWORD));
SetWindowText(notu, " Supply password
");
ShowWindow(notu, SW_SHOW);
SendMessage(notu, WM_CTLCOLOR, 0, 0);
}
- else if (ci->database[0] == '\0')
+ if (ci->database[0] == '\0')
; /* default focus */
else if (ci->server[0] == '\0')
SetFocus(GetDlgItem(hdlg, IDC_SERVER));
@@ -403,6 +402,8 @@ dconn_FDriverConnectProc(
SetFocus(GetDlgItem(hdlg, IDC_PORT));
else if (ci->username[0] == '\0')
SetFocus(GetDlgItem(hdlg, IDC_USER));
+ else if (ci->password[0] == '\0' &&
ci->password_required)
+ SetFocus(GetDlgItem(hdlg, IDC_PASSWORD));
break;

case WM_COMMAND:

*This electronic communication, including any attached documents, may
contain confidential and/or legally privileged information that is intended
only for use by the recipient(s) named above. If you have received this
communication in error, please notify the sender immediately and delete the
communication and any attachments. Views expressed by the author do not
necessarily represent those of Martin Luther College.*

--
This electronic communication, including any attached
documents, may
contain confidential and/or legally privileged
information that is
intended only for use by the recipient(s) named
above. If you have
received this communication in error, please notify
the sender immediately
and delete the communication and any
attachments. Views expressed by the
author do not necessarily represent
those of Martin Luther College.

Browse pgsql-odbc by date

  From Date Subject
Next Message Hiroshi Saito 2021-05-02 12:31:18 psqlODBC 13.01.0000 Released
Previous Message Christophe Pettus 2021-04-20 23:33:45 C99 required?