added user agent header to json auth post.

This commit is contained in:
Nick Bolton 2013-06-04 22:43:16 +00:00
parent 0d4cf81c60
commit 104051adc4
2 changed files with 7 additions and 0 deletions

View File

@ -90,6 +90,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
QString appPath(const QString& name); QString appPath(const QString& name);
void start(bool firstRun); void start(bool firstRun);
void clearLog(); void clearLog();
VersionChecker& versionChecker() { return m_VersionChecker; }
public slots: public slots:
void appendLogRaw(const QString& text); void appendLogRaw(const QString& text);

View File

@ -27,6 +27,7 @@
#include <QNetworkReply> #include <QNetworkReply>
#define PREMIUM_AUTH_URL "https://synergy-foss.org/premium/json/auth/" #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) : SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) :
m_MainWindow(mainWindow), m_MainWindow(mainWindow),
@ -286,7 +287,12 @@ bool SetupWizard::isPremiumLoginValid(QMessageBox& message)
QString requestJson = "{\"email\":\"" + email + "\",\"password\":\"" + password + "\"}"; QString requestJson = "{\"email\":\"" + email + "\",\"password\":\"" + password + "\"}";
QByteArray requestData(requestJson.toStdString().c_str()); 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)); QNetworkRequest request(QUrl(PREMIUM_AUTH_URL));
request.setRawHeader("User-Agent", userAgentData);
QUrl params; QUrl params;
params.addEncodedQueryItem("json", requestData); params.addEncodedQueryItem("json", requestData);