Internal
Public Access
Allow blank usernames, asking for one at connect time instead
Closes #21. SSH and RDP profiles previously hard-required a username to even save the profile; that validation is dropped, and SessionTab::requestConnectOptions() now prompts for it at connect time when blank, reusing the existing password-prompt bar in unmasked mode -- the same pattern already used for a blank password. VNC's username is trickier: most VNC servers never use one (plain VNC Authentication and no-auth don't), only the two Apple auth schemes (security types 30/33) do, and which auth method gets used isn't known until mid-connection, after the server's security-type list has been negotiated -- too late for the pre-connect prompt SSH/RDP uses. Adds a new async request/response pair to SessionBackend, usernameRequested() signal / provideUsername() slot, mirroring the existing SSH host-key- confirmation pattern. VncSessionBackend pauses its state machine right before computing an Apple-auth response if no username is available -- without consuming the already-buffered prime/host-key bytes, so resuming re-parses them identically -- emits the request, and resumes via provideUsername(). Cancelling (or submitting blank) fails the connection cleanly instead of sending Apple auth an empty username. The username is kept on the tab's in-memory profile copy for its lifetime, not written back to the saved profile, matching how passwords are already handled. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+6
-11
@@ -257,13 +257,6 @@ void ProfileDialog::accept()
|
||||
}
|
||||
|
||||
const QString protocol = m_protocolInput->currentText();
|
||||
if ((protocol == QStringLiteral("SSH") || protocol == QStringLiteral("RDP"))
|
||||
&& m_usernameInput->text().trimmed().isEmpty()) {
|
||||
QMessageBox::warning(this,
|
||||
QStringLiteral("Validation Error"),
|
||||
QStringLiteral("Username is required for %1 profiles.").arg(protocol));
|
||||
return;
|
||||
}
|
||||
|
||||
if (protocol == QStringLiteral("SSH")
|
||||
&& m_authModeInput->currentText() == QStringLiteral("Private Key")) {
|
||||
@@ -310,12 +303,14 @@ void ProfileDialog::refreshAuthFields()
|
||||
|
||||
if (isSsh) {
|
||||
m_usernameInput->setPlaceholderText(QStringLiteral("deploy"));
|
||||
m_protocolHint->setText(
|
||||
QStringLiteral("SSH: username is required. Choose Password or Private Key auth."));
|
||||
m_protocolHint->setText(QStringLiteral(
|
||||
"SSH: you'll be asked for a username at connect time if left blank here. "
|
||||
"Choose Password or Private Key auth."));
|
||||
} else if (isRdp) {
|
||||
m_usernameInput->setPlaceholderText(QStringLiteral("Administrator"));
|
||||
m_protocolHint->setText(
|
||||
QStringLiteral("RDP: username and password are required. Domain is optional."));
|
||||
m_protocolHint->setText(QStringLiteral(
|
||||
"RDP: you'll be asked for a username at connect time if left blank here. "
|
||||
"Domain is optional."));
|
||||
} else if (isVnc) {
|
||||
m_usernameInput->setPlaceholderText(QStringLiteral("optional"));
|
||||
m_protocolHint->setText(QStringLiteral(
|
||||
|
||||
Reference in New Issue
Block a user