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