Only send notify request on wizard finish #4932
This commit is contained in:
parent
f03b453c6f
commit
0a1c439535
|
@ -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);
|
||||
|
|
|
@ -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 = "");
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -155,26 +155,14 @@ ToolApp::loginAuth()
|
|||
std::vector<String> 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<String> 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());
|
||||
|
|
Loading…
Reference in New Issue