diff --git a/src/gui/src/CoreInterface.cpp b/src/gui/src/CoreInterface.cpp index 9d24a3df..12703ae7 100644 --- a/src/gui/src/CoreInterface.cpp +++ b/src/gui/src/CoreInterface.cpp @@ -74,11 +74,11 @@ QString CoreInterface::checkSubscription() return run(args); } -QString CoreInterface::notifyActivation(const QString& action) +QString CoreInterface::notifyActivation(const QString& identity) { QStringList args("--notify-activation"); - QString input(action + ":" + hash(getFirstMacAddress())); + QString input(identity + ":" + hash(getFirstMacAddress())); QString os= getOSInformation(); if (!os.isEmpty()) { input.append(":").append(os); diff --git a/src/gui/src/CoreInterface.h b/src/gui/src/CoreInterface.h index 004a3928..f65348af 100644 --- a/src/gui/src/CoreInterface.h +++ b/src/gui/src/CoreInterface.h @@ -31,6 +31,6 @@ public: QString getSubscriptionFilename(); QString activateSerial(const QString& serial); QString checkSubscription(); - QString notifyActivation(const QString& action); + QString notifyActivation(const QString& identity); QString run(const QStringList& args, const QString& input = ""); }; diff --git a/src/gui/src/SetupWizard.cpp b/src/gui/src/SetupWizard.cpp index c45f30a0..ecacab65 100644 --- a/src/gui/src/SetupWizard.cpp +++ b/src/gui/src/SetupWizard.cpp @@ -211,6 +211,9 @@ void SetupWizard::accept() QString hashResult = hash(hashSrc); appConfig.setUserToken(hashResult); appConfig.setEdition(m_Edition); + + CoreInterface coreInterface; + coreInterface.notifyActivation("login:" + m_pLineEditEmail->text()); } if (m_pRadioButtonSubscription->isChecked()) @@ -218,13 +221,13 @@ void SetupWizard::accept() appConfig.setSerialKey(m_pLineEditSerialKey->text()); CoreInterface coreInterface; - coreInterface.notifyActivation("serial"); + coreInterface.notifyActivation("serial:" + m_pLineEditSerialKey->text()); } if (m_pRadioButtonSkip->isChecked()) { CoreInterface coreInterface; - coreInterface.notifyActivation("skip"); + coreInterface.notifyActivation("skip:unknown"); } m_MainWindow.setEdition(m_Edition); @@ -251,6 +254,10 @@ void SetupWizard::reject() m_MainWindow.open(); } + // treat cancel as skip + CoreInterface coreInterface; + coreInterface.notifyActivation("skip:unknown"); + QWizard::reject(); } diff --git a/src/gui/src/WebClient.cpp b/src/gui/src/WebClient.cpp index 9362c008..451bf47f 100644 --- a/src/gui/src/WebClient.cpp +++ b/src/gui/src/WebClient.cpp @@ -94,12 +94,7 @@ QString WebClient::request( { QStringList args("--login-auth"); // hash password in case it contains interesting chars. - QString credentials(email + ":" + hash(password) + ":" + hash(getFirstMacAddress())); - QString os= getOSInformation(); - if (!os.isEmpty()) { - credentials.append(":").append(os); - } - credentials.append("\n"); + QString credentials(email + ":" + hash(password) + "\n"); return m_CoreInterface.run(args, credentials); } diff --git a/src/lib/synergy/ToolApp.cpp b/src/lib/synergy/ToolApp.cpp index 7b5a5715..0b4978b7 100644 --- a/src/lib/synergy/ToolApp.cpp +++ b/src/lib/synergy/ToolApp.cpp @@ -155,26 +155,14 @@ ToolApp::loginAuth() std::vector parts = synergy::string::splitString(credentials, ':'); int count = parts.size(); - if (count == 3 || count == 4) { + if (count == 2 ) { String email = parts[0]; String password = parts[1]; - String macHash = parts[2]; - String os; - - if (count == 4) { - os = parts[3]; - } - else { - os = ARCH->getOSName(); - } std::stringstream ss; ss << JSON_URL << "auth/"; ss << "?email=" << ARCH->internet().urlEncode(email); ss << "&password=" << password; - ss << "&mac=" << macHash; - ss << "&os=" << ARCH->internet().urlEncode(os); - ss << "&arch=" << ARCH->internet().urlEncode(ARCH->getPlatformName()); std::cout << ARCH->internet().get(ss.str()) << std::endl; } @@ -210,13 +198,14 @@ ToolApp::notifyActivation() std::vector parts = synergy::string::splitString(info, ':'); int count = parts.size(); - if (count == 2 || count == 3) { + if (count == 3 || count == 4) { String action = parts[0]; - String macHash = parts[1]; + String identity = parts[1]; + String macHash = parts[2]; String os; - if (count == 3) { - os = parts[2]; + if (count == 4) { + os = parts[3]; } else { os = ARCH->getOSName(); @@ -225,6 +214,7 @@ ToolApp::notifyActivation() std::stringstream ss; ss << JSON_URL << "notify/"; ss << "?action=" << action; + ss << "&identity=" << identity; ss << "&mac=" << macHash; ss << "&os=" << ARCH->internet().urlEncode(ARCH->getOSName()); ss << "&arch=" << ARCH->internet().urlEncode(ARCH->getPlatformName());