mirror of
https://github.com/debauchee/barrier.git
synced 2024-11-23 20:12:39 +03:00
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/LoginWindow.h \
|
||||
src/LoginAuth.h \
|
||||
src/EditionType.h \
|
||||
src/LoginResult.h
|
||||
RESOURCES += res/Synergy.qrc
|
||||
RC_FILE = res/win/Synergy.rc
|
||||
|
@ -129,7 +129,7 @@ void AppConfig::loadSettings()
|
||||
m_AutoConfigPrompted = settings().value("autoConfigPrompted", false).toBool();
|
||||
m_UserEmail = settings().value("userEmail", "").toString();
|
||||
m_UserToken = settings().value("userToken", "").toString();
|
||||
m_EditionType = settings().value("editionType", 0).toInt();
|
||||
m_UserType = settings().value("userType", 0).toInt();
|
||||
}
|
||||
|
||||
void AppConfig::saveSettings()
|
||||
@ -150,7 +150,7 @@ void AppConfig::saveSettings()
|
||||
settings().setValue("autoConfigPrompted", m_AutoConfigPrompted);
|
||||
settings().setValue("userEmail", m_UserEmail);
|
||||
settings().setValue("userToken", m_UserToken);
|
||||
settings().setValue("editionType", m_EditionType);
|
||||
settings().setValue("userType", m_UserType);
|
||||
}
|
||||
|
||||
void AppConfig::setCryptoPass(const QString &s)
|
||||
|
@ -75,7 +75,7 @@ class AppConfig
|
||||
void setAutoConfigPrompted(bool prompted);
|
||||
const QString& userEmail() const { return m_UserEmail; }
|
||||
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 synergycName() const { return m_SynergycName; }
|
||||
@ -101,7 +101,7 @@ class AppConfig
|
||||
void setElevateMode(bool b) { m_ElevateMode = b; }
|
||||
void setUserEmail(const QString& e) { m_UserEmail = e; }
|
||||
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 saveSettings();
|
||||
|
||||
@ -126,7 +126,7 @@ class AppConfig
|
||||
bool m_AutoConfigPrompted;
|
||||
QString m_UserEmail;
|
||||
QString m_UserToken;
|
||||
int m_EditionType;
|
||||
int m_UserType;
|
||||
|
||||
static const char m_SynergysName[];
|
||||
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 "QUtility.h"
|
||||
#include "LoginResult.h"
|
||||
#include "EditionType.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QCoreApplication>
|
||||
@ -30,14 +29,12 @@
|
||||
|
||||
void LoginAuth::checkUserType()
|
||||
{
|
||||
int edition = Unknown;
|
||||
int result = doCheckUserType(edition);
|
||||
int result = doCheckUserType();
|
||||
m_pLoginWindow->setLoginResult(result);
|
||||
m_pLoginWindow->setEditionType(edition);
|
||||
emit finished();
|
||||
}
|
||||
|
||||
int LoginAuth::doCheckUserType(int& edition)
|
||||
int LoginAuth::doCheckUserType()
|
||||
{
|
||||
QString responseJson;
|
||||
|
||||
@ -55,12 +52,7 @@ int LoginAuth::doCheckUserType(int& edition)
|
||||
if (resultRegex.exactMatch(responseJson)) {
|
||||
QString boolString = resultRegex.cap(1);
|
||||
if (boolString == "true") {
|
||||
QRegExp editionRegex(".*\"edition\".*:.*\"(.+)\",.*");
|
||||
if (editionRegex.exactMatch(responseJson)) {
|
||||
QString e = editionRegex.cap(1);
|
||||
edition = e.toInt();
|
||||
}
|
||||
return Ok;
|
||||
return Home;
|
||||
}
|
||||
else if (boolString == "false") {
|
||||
return InvalidEmailPassword;
|
||||
|
@ -29,7 +29,7 @@ class LoginAuth : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
int doCheckUserType(int& edition);
|
||||
int doCheckUserType();
|
||||
void setEmail(QString email) { m_Email = email; }
|
||||
void setPassword(QString password) { m_Password = password; }
|
||||
void setLoginWindow(LoginWindow* w) { m_pLoginWindow = w; }
|
||||
|
@ -1,29 +1,32 @@
|
||||
/*
|
||||
* 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 LOGINRESULT_H
|
||||
#define LOGINRESULT_H
|
||||
|
||||
enum qLoginResult {
|
||||
Ok,
|
||||
Error,
|
||||
ExceptionError,
|
||||
InvalidEmailPassword,
|
||||
ServerResponseError
|
||||
};
|
||||
|
||||
#endif // LOGINRESULT_H
|
||||
/*
|
||||
* 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 LOGINRESULT_H
|
||||
#define LOGINRESULT_H
|
||||
|
||||
enum qLoginResult {
|
||||
Unknown,
|
||||
Student,
|
||||
Home,
|
||||
Professional,
|
||||
Error,
|
||||
ExceptionError,
|
||||
InvalidEmailPassword,
|
||||
ServerResponseError
|
||||
};
|
||||
|
||||
#endif // LOGINRESULT_H
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "SetupWizard.h"
|
||||
#include "LoginAuth.h"
|
||||
#include "LoginResult.h"
|
||||
#include "EditionType.h"
|
||||
#include "QUtility.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
@ -39,8 +38,7 @@ LoginWindow::LoginWindow(
|
||||
m_pSetupWizard(setupWizard),
|
||||
m_WizardShouldRun(wizardShouldRun),
|
||||
m_pLoginAuth(NULL),
|
||||
m_LoginResult(Ok),
|
||||
m_EditionType(Unknown),
|
||||
m_LoginResult(Unknown),
|
||||
m_AppConfig(m_pMainWindow->appConfig())
|
||||
{
|
||||
setupUi(this);
|
||||
@ -90,16 +88,16 @@ void LoginWindow::showNext()
|
||||
m_pSetupWizard->show();
|
||||
}
|
||||
else {
|
||||
m_pMainWindow->setEditionType(m_EditionType);
|
||||
m_pMainWindow->setLoginResult(m_LoginResult);
|
||||
if (!m_pLineEditEmail->text().isEmpty()) {
|
||||
m_AppConfig.setUserEmail(m_pLineEditEmail->text());
|
||||
|
||||
if (m_EditionType != Unknown) {
|
||||
if (m_LoginResult != Unknown) {
|
||||
QString mac = getFirstMacAddress();
|
||||
QString hashSrc = m_pLineEditEmail->text() + mac;
|
||||
QString hashResult = hash(hashSrc);
|
||||
m_AppConfig.setUserToken(hashResult);
|
||||
m_AppConfig.setEditionType(m_EditionType);
|
||||
m_AppConfig.setUserType(m_LoginResult);
|
||||
}
|
||||
}
|
||||
m_pMainWindow->show();
|
||||
@ -108,9 +106,8 @@ void LoginWindow::showNext()
|
||||
|
||||
delete m_pLoginAuth;
|
||||
m_pLoginAuth = NULL;
|
||||
m_LoginResult = Ok;
|
||||
m_EditionType = Unknown;
|
||||
m_pPushButtonLogin->setEnabled(true);
|
||||
m_LoginResult = Unknown;
|
||||
m_pPushButtonLogin->setText("Login");
|
||||
m_pPushButtonLogin->setDefault(true);
|
||||
}
|
||||
|
||||
@ -153,7 +150,7 @@ void LoginWindow::on_m_pPushButtonLogin_clicked()
|
||||
m_pLoginAuth->setLoginWindow(this);
|
||||
}
|
||||
|
||||
m_pPushButtonLogin->setEnabled(false);
|
||||
m_pPushButtonLogin->setText("Logging...");
|
||||
|
||||
QString email = m_pLineEditEmail->text();
|
||||
QString password = m_pLineEditPassword->text();
|
||||
|
@ -38,7 +38,6 @@ public:
|
||||
~LoginWindow();
|
||||
|
||||
void setLoginResult(int result) { m_LoginResult = result; }
|
||||
void setEditionType(int type) { m_EditionType = type; }
|
||||
void setError(QString error) { m_Error = error; }
|
||||
|
||||
protected:
|
||||
@ -58,7 +57,6 @@ private:
|
||||
bool m_WizardShouldRun;
|
||||
LoginAuth* m_pLoginAuth;
|
||||
int m_LoginResult;
|
||||
int m_EditionType;
|
||||
QString m_Error;
|
||||
AppConfig& m_AppConfig;
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "DataDownloader.h"
|
||||
#include "CommandProcess.h"
|
||||
#include "LoginAuth.h"
|
||||
#include "EditionType.h"
|
||||
#include "LoginResult.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
@ -92,7 +92,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
||||
m_SuppressAutoConfigWarning(false),
|
||||
m_BonjourInstall(NULL),
|
||||
m_SuppressEmptyServerWarning(false),
|
||||
m_EditionType(Unknown)
|
||||
m_LoginResult(Unknown)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
@ -878,14 +878,17 @@ int MainWindow::checkWinArch()
|
||||
return unknown;
|
||||
}
|
||||
|
||||
void MainWindow::setEditionType(int type)
|
||||
void MainWindow::setLoginResult(int result)
|
||||
{
|
||||
m_EditionType = type;
|
||||
m_LoginResult = result;
|
||||
QString title;
|
||||
if (type == Basic) {
|
||||
title = "Synergy Basic";
|
||||
if (result == Student) {
|
||||
title = "Synergy Student";
|
||||
}
|
||||
else if (type == Pro) {
|
||||
else if (result == Home) {
|
||||
title = "Synergy Home";
|
||||
}
|
||||
else if (result == Professional) {
|
||||
title = "Synergy Pro";
|
||||
}
|
||||
else {
|
||||
|
@ -112,7 +112,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
void updateZeroconfService();
|
||||
void serverDetected(const QString name);
|
||||
int checkWinArch();
|
||||
void setEditionType(int edition);
|
||||
void setLoginResult(int result);
|
||||
AppConfig& appConfig() { return m_AppConfig; }
|
||||
|
||||
public slots:
|
||||
@ -193,7 +193,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
bool m_SuppressAutoConfigWarning;
|
||||
CommandProcess* m_BonjourInstall;
|
||||
bool m_SuppressEmptyServerWarning;
|
||||
int m_EditionType;
|
||||
int m_LoginResult;
|
||||
|
||||
private slots:
|
||||
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
|
||||
|
@ -105,7 +105,7 @@ int main(int argc, char* argv[])
|
||||
QString hashSrc = email + mac;
|
||||
QString hashResult = hash(hashSrc);
|
||||
if (hashResult == appConfig.userToken()) {
|
||||
mainWindow.setEditionType(appConfig.editionType());
|
||||
mainWindow.setLoginResult(appConfig.userType());
|
||||
mainWindow.show();
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user