refactor: Messages::showNewClientPrompt check if server auth is needed when the message is shown not in the signal
This commit is contained in:
parent
047451696a
commit
d8e9ac27f5
6 changed files with 9 additions and 10 deletions
|
|
@ -1187,10 +1187,10 @@ void MainWindow::showClientError(deskflow::client::ErrorType error, const QStrin
|
||||||
m_clientErrorVisible = false;
|
m_clientErrorVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::handleNewClientPromptRequest(const QString &clientName, bool usePeerAuth)
|
void MainWindow::handleNewClientPromptRequest(const QString &clientName)
|
||||||
{
|
{
|
||||||
showAndActivate();
|
showAndActivate();
|
||||||
bool result = deskflow::gui::messages::showNewClientPrompt(this, clientName, usePeerAuth);
|
bool result = deskflow::gui::messages::showNewClientPrompt(this, clientName);
|
||||||
m_serverConnection.handleNewClientResult(clientName, result);
|
m_serverConnection.handleNewClientResult(clientName, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ private:
|
||||||
void daemonIpcClientConnectionFailed();
|
void daemonIpcClientConnectionFailed();
|
||||||
void toggleCanRunCore(bool enableButtons);
|
void toggleCanRunCore(bool enableButtons);
|
||||||
void remoteHostChanged(const QString &newRemoteHost);
|
void remoteHostChanged(const QString &newRemoteHost);
|
||||||
void handleNewClientPromptRequest(const QString &clientName, bool usePeerAuth);
|
void handleNewClientPromptRequest(const QString &clientName);
|
||||||
void updateIpLabel(const QStringList &addresses);
|
void updateIpLabel(const QStringList &addresses);
|
||||||
void updateTimeoutDelay(int newDelay);
|
void updateTimeoutDelay(int newDelay);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,9 +184,10 @@ void showFirstConnectedMessage(QWidget *parent)
|
||||||
QMessageBox::information(parent, title, message);
|
QMessageBox::information(parent, title, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool showNewClientPrompt(QWidget *parent, const QString &clientName, bool serverRequiresPeerAuth)
|
bool showNewClientPrompt(QWidget *parent, const QString &clientName)
|
||||||
{
|
{
|
||||||
if (serverRequiresPeerAuth) {
|
if (Settings::value(Settings::Security::TlsEnabled).toBool() &&
|
||||||
|
Settings::value(Settings::Security::CheckPeers).toBool()) {
|
||||||
// When peer auth is enabled you will be prompted to allow the connection before seeing this dialog.
|
// When peer auth is enabled you will be prompted to allow the connection before seeing this dialog.
|
||||||
// This is why we do not show a dialog with an option to ignore the new client
|
// This is why we do not show a dialog with an option to ignore the new client
|
||||||
QMessageBox::information(
|
QMessageBox::information(
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ void showFirstConnectedMessage(QWidget *parent);
|
||||||
|
|
||||||
void showCloseReminder(QWidget *parent);
|
void showCloseReminder(QWidget *parent);
|
||||||
|
|
||||||
bool showNewClientPrompt(QWidget *parent, const QString &clientName, bool serverRequiresPeerAuth = false);
|
bool showNewClientPrompt(QWidget *parent, const QString &clientName);
|
||||||
|
|
||||||
bool showClearSettings(QWidget *parent);
|
bool showClearSettings(QWidget *parent);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,9 +82,7 @@ void ServerConnection::handleNewClient(const QString &clientName)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_messageShowing = true;
|
m_messageShowing = true;
|
||||||
const bool tlsEnabled = Settings::value(Settings::Security::TlsEnabled).toBool();
|
Q_EMIT requestNewClientPrompt(clientName);
|
||||||
const bool requireCerts = Settings::value(Settings::Security::CheckPeers).toBool();
|
|
||||||
Q_EMIT requestNewClientPrompt(clientName, tlsEnabled && requireCerts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerConnection::handleNewClientResult(const QString &clientName, bool acceptClient)
|
void ServerConnection::handleNewClientResult(const QString &clientName, bool acceptClient)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public:
|
||||||
void handleNewClientResult(const QString &clientName, bool acceptClient);
|
void handleNewClientResult(const QString &clientName, bool acceptClient);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void requestNewClientPrompt(const QString &clientName, bool peerAuthRequired);
|
void requestNewClientPrompt(const QString &clientName);
|
||||||
void configureClient(const QString &clientName);
|
void configureClient(const QString &clientName);
|
||||||
void clientsChanged(const QStringList &clients);
|
void clientsChanged(const QStringList &clients);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue