From 104051adc43a5490ddb9ab66f8821a859f4b6c72 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Tue, 4 Jun 2013 22:43:16 +0000 Subject: [PATCH] added user agent header to json auth post. --- src/gui/src/MainWindow.h | 1 + src/gui/src/SetupWizard.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 394c275d..25827705 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -90,6 +90,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase QString appPath(const QString& name); void start(bool firstRun); void clearLog(); + VersionChecker& versionChecker() { return m_VersionChecker; } public slots: void appendLogRaw(const QString& text); diff --git a/src/gui/src/SetupWizard.cpp b/src/gui/src/SetupWizard.cpp index 3c86294f..006f1253 100644 --- a/src/gui/src/SetupWizard.cpp +++ b/src/gui/src/SetupWizard.cpp @@ -27,6 +27,7 @@ #include #define PREMIUM_AUTH_URL "https://synergy-foss.org/premium/json/auth/" +//#define PREMIUM_AUTH_URL "http://localhost/synergy/premium/json/auth/" SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) : m_MainWindow(mainWindow), @@ -286,7 +287,12 @@ bool SetupWizard::isPremiumLoginValid(QMessageBox& message) QString requestJson = "{\"email\":\"" + email + "\",\"password\":\"" + password + "\"}"; QByteArray requestData(requestJson.toStdString().c_str()); + QString version = m_MainWindow.versionChecker().getVersion(); + QString userAgent = "Synergy GUI " + version; + QByteArray userAgentData(userAgent.toStdString().c_str()); + QNetworkRequest request(QUrl(PREMIUM_AUTH_URL)); + request.setRawHeader("User-Agent", userAgentData); QUrl params; params.addEncodedQueryItem("json", requestData);