Revert "seperated login result and edition type #4168"
This reverts commit da68664bda
.
This commit is contained in:
parent
c81fa7db52
commit
c34928b7c8
|
@ -92,7 +92,6 @@ HEADERS += src/MainWindow.h \
|
||||||
src/CommandProcess.h \
|
src/CommandProcess.h \
|
||||||
src/LoginWindow.h \
|
src/LoginWindow.h \
|
||||||
src/LoginAuth.h \
|
src/LoginAuth.h \
|
||||||
src/EditionType.h \
|
|
||||||
src/LoginResult.h
|
src/LoginResult.h
|
||||||
RESOURCES += res/Synergy.qrc
|
RESOURCES += res/Synergy.qrc
|
||||||
RC_FILE = res/win/Synergy.rc
|
RC_FILE = res/win/Synergy.rc
|
||||||
|
|
|
@ -129,7 +129,7 @@ void AppConfig::loadSettings()
|
||||||
m_AutoConfigPrompted = settings().value("autoConfigPrompted", false).toBool();
|
m_AutoConfigPrompted = settings().value("autoConfigPrompted", false).toBool();
|
||||||
m_UserEmail = settings().value("userEmail", "").toString();
|
m_UserEmail = settings().value("userEmail", "").toString();
|
||||||
m_UserToken = settings().value("userToken", "").toString();
|
m_UserToken = settings().value("userToken", "").toString();
|
||||||
m_EditionType = settings().value("editionType", 0).toInt();
|
m_UserType = settings().value("userType", 0).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppConfig::saveSettings()
|
void AppConfig::saveSettings()
|
||||||
|
@ -150,7 +150,7 @@ void AppConfig::saveSettings()
|
||||||
settings().setValue("autoConfigPrompted", m_AutoConfigPrompted);
|
settings().setValue("autoConfigPrompted", m_AutoConfigPrompted);
|
||||||
settings().setValue("userEmail", m_UserEmail);
|
settings().setValue("userEmail", m_UserEmail);
|
||||||
settings().setValue("userToken", m_UserToken);
|
settings().setValue("userToken", m_UserToken);
|
||||||
settings().setValue("editionType", m_EditionType);
|
settings().setValue("userType", m_UserType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppConfig::setCryptoPass(const QString &s)
|
void AppConfig::setCryptoPass(const QString &s)
|
||||||
|
|
|
@ -75,7 +75,7 @@ class AppConfig
|
||||||
void setAutoConfigPrompted(bool prompted);
|
void setAutoConfigPrompted(bool prompted);
|
||||||
const QString& userEmail() const { return m_UserEmail; }
|
const QString& userEmail() const { return m_UserEmail; }
|
||||||
const QString& userToken() const { return m_UserToken; }
|
const QString& userToken() const { return m_UserToken; }
|
||||||
const int editionType() const { return m_EditionType; }
|
const int userType() const { return m_UserType; }
|
||||||
|
|
||||||
QString synergysName() const { return m_SynergysName; }
|
QString synergysName() const { return m_SynergysName; }
|
||||||
QString synergycName() const { return m_SynergycName; }
|
QString synergycName() const { return m_SynergycName; }
|
||||||
|
@ -101,7 +101,7 @@ class AppConfig
|
||||||
void setElevateMode(bool b) { m_ElevateMode = b; }
|
void setElevateMode(bool b) { m_ElevateMode = b; }
|
||||||
void setUserEmail(const QString& e) { m_UserEmail = e; }
|
void setUserEmail(const QString& e) { m_UserEmail = e; }
|
||||||
void setUserToken(const QString& t) { m_UserToken = t; }
|
void setUserToken(const QString& t) { m_UserToken = t; }
|
||||||
void setEditionType(int t) { m_EditionType = t; }
|
void setUserType(int t) { m_UserType = t; }
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ class AppConfig
|
||||||
bool m_AutoConfigPrompted;
|
bool m_AutoConfigPrompted;
|
||||||
QString m_UserEmail;
|
QString m_UserEmail;
|
||||||
QString m_UserToken;
|
QString m_UserToken;
|
||||||
int m_EditionType;
|
int m_UserType;
|
||||||
|
|
||||||
static const char m_SynergysName[];
|
static const char m_SynergysName[];
|
||||||
static const char m_SynergycName[];
|
static const char m_SynergycName[];
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
/*
|
|
||||||
* synergy -- mouse and keyboard sharing utility
|
|
||||||
* Copyright (C) 2015 Synergy Si Ltd.
|
|
||||||
*
|
|
||||||
* This package is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* found in the file COPYING that should have accompanied this file.
|
|
||||||
*
|
|
||||||
* This package is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EDITIONTYPE_H
|
|
||||||
#define EDITIONTYPE_H
|
|
||||||
|
|
||||||
enum qEditionType {
|
|
||||||
Basic,
|
|
||||||
Pro,
|
|
||||||
Unknown
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // EDITIONTYPE_H
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "AppConfig.h"
|
#include "AppConfig.h"
|
||||||
#include "QUtility.h"
|
#include "QUtility.h"
|
||||||
#include "LoginResult.h"
|
#include "LoginResult.h"
|
||||||
#include "EditionType.h"
|
|
||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
@ -30,14 +29,12 @@
|
||||||
|
|
||||||
void LoginAuth::checkUserType()
|
void LoginAuth::checkUserType()
|
||||||
{
|
{
|
||||||
int edition = Unknown;
|
int result = doCheckUserType();
|
||||||
int result = doCheckUserType(edition);
|
|
||||||
m_pLoginWindow->setLoginResult(result);
|
m_pLoginWindow->setLoginResult(result);
|
||||||
m_pLoginWindow->setEditionType(edition);
|
|
||||||
emit finished();
|
emit finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
int LoginAuth::doCheckUserType(int& edition)
|
int LoginAuth::doCheckUserType()
|
||||||
{
|
{
|
||||||
QString responseJson;
|
QString responseJson;
|
||||||
|
|
||||||
|
@ -55,12 +52,7 @@ int LoginAuth::doCheckUserType(int& edition)
|
||||||
if (resultRegex.exactMatch(responseJson)) {
|
if (resultRegex.exactMatch(responseJson)) {
|
||||||
QString boolString = resultRegex.cap(1);
|
QString boolString = resultRegex.cap(1);
|
||||||
if (boolString == "true") {
|
if (boolString == "true") {
|
||||||
QRegExp editionRegex(".*\"edition\".*:.*\"(.+)\",.*");
|
return Home;
|
||||||
if (editionRegex.exactMatch(responseJson)) {
|
|
||||||
QString e = editionRegex.cap(1);
|
|
||||||
edition = e.toInt();
|
|
||||||
}
|
|
||||||
return Ok;
|
|
||||||
}
|
}
|
||||||
else if (boolString == "false") {
|
else if (boolString == "false") {
|
||||||
return InvalidEmailPassword;
|
return InvalidEmailPassword;
|
||||||
|
|
|
@ -29,7 +29,7 @@ class LoginAuth : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int doCheckUserType(int& edition);
|
int doCheckUserType();
|
||||||
void setEmail(QString email) { m_Email = email; }
|
void setEmail(QString email) { m_Email = email; }
|
||||||
void setPassword(QString password) { m_Password = password; }
|
void setPassword(QString password) { m_Password = password; }
|
||||||
void setLoginWindow(LoginWindow* w) { m_pLoginWindow = w; }
|
void setLoginWindow(LoginWindow* w) { m_pLoginWindow = w; }
|
||||||
|
|
|
@ -1,29 +1,32 @@
|
||||||
/*
|
/*
|
||||||
* synergy -- mouse and keyboard sharing utility
|
* synergy -- mouse and keyboard sharing utility
|
||||||
* Copyright (C) 2015 Synergy Si Ltd.
|
* Copyright (C) 2015 Synergy Si Ltd.
|
||||||
*
|
*
|
||||||
* This package is free software; you can redistribute it and/or
|
* This package is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* found in the file COPYING that should have accompanied this file.
|
* found in the file COPYING that should have accompanied this file.
|
||||||
*
|
*
|
||||||
* This package is distributed in the hope that it will be useful,
|
* This package is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LOGINRESULT_H
|
#ifndef LOGINRESULT_H
|
||||||
#define LOGINRESULT_H
|
#define LOGINRESULT_H
|
||||||
|
|
||||||
enum qLoginResult {
|
enum qLoginResult {
|
||||||
Ok,
|
Unknown,
|
||||||
Error,
|
Student,
|
||||||
ExceptionError,
|
Home,
|
||||||
InvalidEmailPassword,
|
Professional,
|
||||||
ServerResponseError
|
Error,
|
||||||
};
|
ExceptionError,
|
||||||
|
InvalidEmailPassword,
|
||||||
#endif // LOGINRESULT_H
|
ServerResponseError
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LOGINRESULT_H
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "SetupWizard.h"
|
#include "SetupWizard.h"
|
||||||
#include "LoginAuth.h"
|
#include "LoginAuth.h"
|
||||||
#include "LoginResult.h"
|
#include "LoginResult.h"
|
||||||
#include "EditionType.h"
|
|
||||||
#include "QUtility.h"
|
#include "QUtility.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
@ -39,8 +38,7 @@ LoginWindow::LoginWindow(
|
||||||
m_pSetupWizard(setupWizard),
|
m_pSetupWizard(setupWizard),
|
||||||
m_WizardShouldRun(wizardShouldRun),
|
m_WizardShouldRun(wizardShouldRun),
|
||||||
m_pLoginAuth(NULL),
|
m_pLoginAuth(NULL),
|
||||||
m_LoginResult(Ok),
|
m_LoginResult(Unknown),
|
||||||
m_EditionType(Unknown),
|
|
||||||
m_AppConfig(m_pMainWindow->appConfig())
|
m_AppConfig(m_pMainWindow->appConfig())
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
@ -90,16 +88,16 @@ void LoginWindow::showNext()
|
||||||
m_pSetupWizard->show();
|
m_pSetupWizard->show();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_pMainWindow->setEditionType(m_EditionType);
|
m_pMainWindow->setLoginResult(m_LoginResult);
|
||||||
if (!m_pLineEditEmail->text().isEmpty()) {
|
if (!m_pLineEditEmail->text().isEmpty()) {
|
||||||
m_AppConfig.setUserEmail(m_pLineEditEmail->text());
|
m_AppConfig.setUserEmail(m_pLineEditEmail->text());
|
||||||
|
|
||||||
if (m_EditionType != Unknown) {
|
if (m_LoginResult != Unknown) {
|
||||||
QString mac = getFirstMacAddress();
|
QString mac = getFirstMacAddress();
|
||||||
QString hashSrc = m_pLineEditEmail->text() + mac;
|
QString hashSrc = m_pLineEditEmail->text() + mac;
|
||||||
QString hashResult = hash(hashSrc);
|
QString hashResult = hash(hashSrc);
|
||||||
m_AppConfig.setUserToken(hashResult);
|
m_AppConfig.setUserToken(hashResult);
|
||||||
m_AppConfig.setEditionType(m_EditionType);
|
m_AppConfig.setUserType(m_LoginResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_pMainWindow->show();
|
m_pMainWindow->show();
|
||||||
|
@ -108,9 +106,8 @@ void LoginWindow::showNext()
|
||||||
|
|
||||||
delete m_pLoginAuth;
|
delete m_pLoginAuth;
|
||||||
m_pLoginAuth = NULL;
|
m_pLoginAuth = NULL;
|
||||||
m_LoginResult = Ok;
|
m_LoginResult = Unknown;
|
||||||
m_EditionType = Unknown;
|
m_pPushButtonLogin->setText("Login");
|
||||||
m_pPushButtonLogin->setEnabled(true);
|
|
||||||
m_pPushButtonLogin->setDefault(true);
|
m_pPushButtonLogin->setDefault(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +150,7 @@ void LoginWindow::on_m_pPushButtonLogin_clicked()
|
||||||
m_pLoginAuth->setLoginWindow(this);
|
m_pLoginAuth->setLoginWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pPushButtonLogin->setEnabled(false);
|
m_pPushButtonLogin->setText("Logging...");
|
||||||
|
|
||||||
QString email = m_pLineEditEmail->text();
|
QString email = m_pLineEditEmail->text();
|
||||||
QString password = m_pLineEditPassword->text();
|
QString password = m_pLineEditPassword->text();
|
||||||
|
|
|
@ -38,7 +38,6 @@ public:
|
||||||
~LoginWindow();
|
~LoginWindow();
|
||||||
|
|
||||||
void setLoginResult(int result) { m_LoginResult = result; }
|
void setLoginResult(int result) { m_LoginResult = result; }
|
||||||
void setEditionType(int type) { m_EditionType = type; }
|
|
||||||
void setError(QString error) { m_Error = error; }
|
void setError(QString error) { m_Error = error; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -58,7 +57,6 @@ private:
|
||||||
bool m_WizardShouldRun;
|
bool m_WizardShouldRun;
|
||||||
LoginAuth* m_pLoginAuth;
|
LoginAuth* m_pLoginAuth;
|
||||||
int m_LoginResult;
|
int m_LoginResult;
|
||||||
int m_EditionType;
|
|
||||||
QString m_Error;
|
QString m_Error;
|
||||||
AppConfig& m_AppConfig;
|
AppConfig& m_AppConfig;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "DataDownloader.h"
|
#include "DataDownloader.h"
|
||||||
#include "CommandProcess.h"
|
#include "CommandProcess.h"
|
||||||
#include "LoginAuth.h"
|
#include "LoginAuth.h"
|
||||||
#include "EditionType.h"
|
#include "LoginResult.h"
|
||||||
|
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
@ -92,7 +92,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
||||||
m_SuppressAutoConfigWarning(false),
|
m_SuppressAutoConfigWarning(false),
|
||||||
m_BonjourInstall(NULL),
|
m_BonjourInstall(NULL),
|
||||||
m_SuppressEmptyServerWarning(false),
|
m_SuppressEmptyServerWarning(false),
|
||||||
m_EditionType(Unknown)
|
m_LoginResult(Unknown)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
@ -878,14 +878,17 @@ int MainWindow::checkWinArch()
|
||||||
return unknown;
|
return unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setEditionType(int type)
|
void MainWindow::setLoginResult(int result)
|
||||||
{
|
{
|
||||||
m_EditionType = type;
|
m_LoginResult = result;
|
||||||
QString title;
|
QString title;
|
||||||
if (type == Basic) {
|
if (result == Student) {
|
||||||
title = "Synergy Basic";
|
title = "Synergy Student";
|
||||||
}
|
}
|
||||||
else if (type == Pro) {
|
else if (result == Home) {
|
||||||
|
title = "Synergy Home";
|
||||||
|
}
|
||||||
|
else if (result == Professional) {
|
||||||
title = "Synergy Pro";
|
title = "Synergy Pro";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -112,7 +112,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
void updateZeroconfService();
|
void updateZeroconfService();
|
||||||
void serverDetected(const QString name);
|
void serverDetected(const QString name);
|
||||||
int checkWinArch();
|
int checkWinArch();
|
||||||
void setEditionType(int edition);
|
void setLoginResult(int result);
|
||||||
AppConfig& appConfig() { return m_AppConfig; }
|
AppConfig& appConfig() { return m_AppConfig; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -193,7 +193,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
bool m_SuppressAutoConfigWarning;
|
bool m_SuppressAutoConfigWarning;
|
||||||
CommandProcess* m_BonjourInstall;
|
CommandProcess* m_BonjourInstall;
|
||||||
bool m_SuppressEmptyServerWarning;
|
bool m_SuppressEmptyServerWarning;
|
||||||
int m_EditionType;
|
int m_LoginResult;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
|
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
|
||||||
|
|
|
@ -105,7 +105,7 @@ int main(int argc, char* argv[])
|
||||||
QString hashSrc = email + mac;
|
QString hashSrc = email + mac;
|
||||||
QString hashResult = hash(hashSrc);
|
QString hashResult = hash(hashSrc);
|
||||||
if (hashResult == appConfig.userToken()) {
|
if (hashResult == appConfig.userToken()) {
|
||||||
mainWindow.setEditionType(appConfig.editionType());
|
mainWindow.setLoginResult(appConfig.userType());
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue