Revert "stored user email, token and type in settings #4168"
This reverts commit 319de60286
.
This commit is contained in:
parent
f4f7315a54
commit
c25b6a8bf6
|
@ -91,8 +91,7 @@ HEADERS += src/MainWindow.h \
|
|||
src/AddClientDialog.h \
|
||||
src/CommandProcess.h \
|
||||
src/LoginWindow.h \
|
||||
src/LoginAuth.h \
|
||||
src/LoginResult.h
|
||||
src/LoginAuth.h
|
||||
RESOURCES += res/Synergy.qrc
|
||||
RC_FILE = res/win/Synergy.rc
|
||||
macx {
|
||||
|
|
|
@ -127,9 +127,6 @@ void AppConfig::loadSettings()
|
|||
m_AutoConfig = settings().value("autoConfig", true).toBool();
|
||||
m_ElevateMode = settings().value("elevateMode", false).toBool();
|
||||
m_AutoConfigPrompted = settings().value("autoConfigPrompted", false).toBool();
|
||||
m_UserEmail = settings().value("userEmail", "").toString();
|
||||
m_UserToken = settings().value("userToken", "").toString();
|
||||
m_UserType = settings().value("userType", 0).toInt();
|
||||
}
|
||||
|
||||
void AppConfig::saveSettings()
|
||||
|
@ -148,9 +145,6 @@ void AppConfig::saveSettings()
|
|||
settings().setValue("autoConfig", m_AutoConfig);
|
||||
settings().setValue("elevateMode", m_ElevateMode);
|
||||
settings().setValue("autoConfigPrompted", m_AutoConfigPrompted);
|
||||
settings().setValue("userEmail", m_UserEmail);
|
||||
settings().setValue("userToken", m_UserToken);
|
||||
settings().setValue("userType", m_UserType);
|
||||
}
|
||||
|
||||
void AppConfig::setCryptoPass(const QString &s)
|
||||
|
|
|
@ -47,7 +47,6 @@ class AppConfig
|
|||
friend class SettingsDialog;
|
||||
friend class MainWindow;
|
||||
friend class SetupWizard;
|
||||
friend class LoginWindow;
|
||||
|
||||
public:
|
||||
AppConfig(QSettings* settings);
|
||||
|
@ -73,9 +72,6 @@ class AppConfig
|
|||
void setAutoConfig(bool autoConfig);
|
||||
bool autoConfigPrompted() { return m_AutoConfigPrompted; }
|
||||
void setAutoConfigPrompted(bool prompted);
|
||||
const QString& userEmail() const { return m_UserEmail; }
|
||||
const QString& userToken() const { return m_UserToken; }
|
||||
const int userType() const { return m_UserType; }
|
||||
|
||||
QString synergysName() const { return m_SynergysName; }
|
||||
QString synergycName() const { return m_SynergycName; }
|
||||
|
@ -99,9 +95,7 @@ class AppConfig
|
|||
void setLanguage(const QString language) { m_Language = language; }
|
||||
void setStartedBefore(bool b) { m_StartedBefore = b; }
|
||||
void setElevateMode(bool b) { m_ElevateMode = b; }
|
||||
void setUserEmail(const QString& e) { m_UserEmail = e; }
|
||||
void setUserToken(const QString& t) { m_UserToken = t; }
|
||||
void setUserType(int t) { m_UserType = t; }
|
||||
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
|
||||
|
@ -124,9 +118,6 @@ class AppConfig
|
|||
bool m_AutoConfig;
|
||||
bool m_ElevateMode;
|
||||
bool m_AutoConfigPrompted;
|
||||
QString m_UserEmail;
|
||||
QString m_UserToken;
|
||||
int m_UserType;
|
||||
|
||||
static const char m_SynergysName[];
|
||||
static const char m_SynergycName[];
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
#include "LoginAuth.h"
|
||||
|
||||
#include "LoginWindow.h"
|
||||
#include "AppConfig.h"
|
||||
#include "QUtility.h"
|
||||
#include "LoginResult.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QCoreApplication>
|
||||
|
@ -96,3 +93,10 @@ QString LoginAuth::request(const QString& email, const QString& password)
|
|||
|
||||
return out;
|
||||
}
|
||||
|
||||
QString LoginAuth::hash(const QString& string)
|
||||
{
|
||||
QByteArray data = string.toUtf8();
|
||||
QByteArray hash = QCryptographicHash::hash(data, QCryptographicHash::Md5);
|
||||
return hash.toHex();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,18 @@
|
|||
#include <QObject>
|
||||
|
||||
class LoginWindow;
|
||||
class AppConfig;
|
||||
|
||||
enum qUserType {
|
||||
Student,
|
||||
Home,
|
||||
Professional,
|
||||
Error,
|
||||
ExceptionError,
|
||||
InvalidEmailPassword,
|
||||
ServerResponseError,
|
||||
Unknown
|
||||
|
||||
};
|
||||
|
||||
class LoginAuth : public QObject
|
||||
{
|
||||
|
@ -25,6 +36,7 @@ signals:
|
|||
|
||||
private:
|
||||
QString request(const QString& email, const QString& password);
|
||||
QString hash(const QString& string);
|
||||
|
||||
private:
|
||||
QString m_Email;
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef LOGINRESULT_H
|
||||
#define LOGINRESULT_H
|
||||
|
||||
enum qLoginResult {
|
||||
Unknown,
|
||||
Student,
|
||||
Home,
|
||||
Professional,
|
||||
Error,
|
||||
ExceptionError,
|
||||
InvalidEmailPassword,
|
||||
ServerResponseError
|
||||
};
|
||||
|
||||
#endif // LOGINRESULT_H
|
|
@ -4,8 +4,6 @@
|
|||
#include "MainWindow.h"
|
||||
#include "SetupWizard.h"
|
||||
#include "LoginAuth.h"
|
||||
#include "LoginResult.h"
|
||||
#include "QUtility.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
|
@ -21,12 +19,11 @@ LoginWindow::LoginWindow(
|
|||
m_pSetupWizard(setupWizard),
|
||||
m_WizardShouldRun(wizardShouldRun),
|
||||
m_pLoginAuth(NULL),
|
||||
m_LoginResult(Unknown),
|
||||
m_AppConfig(m_pMainWindow->appConfig())
|
||||
m_LoginResult(Unknown)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
m_pLineEditEmail->setText(m_AppConfig.userEmail());
|
||||
|
||||
}
|
||||
|
||||
LoginWindow::~LoginWindow()
|
||||
|
@ -72,17 +69,6 @@ void LoginWindow::showNext()
|
|||
}
|
||||
else {
|
||||
m_pMainWindow->setLoginResult(m_LoginResult);
|
||||
if (!m_pLineEditEmail->text().isEmpty()) {
|
||||
m_AppConfig.setUserEmail(m_pLineEditEmail->text());
|
||||
|
||||
if (m_LoginResult != Unknown) {
|
||||
QString mac = getFirstMacAddress();
|
||||
QString hashSrc = m_pLineEditEmail->text() + mac;
|
||||
QString hashResult = hash(hashSrc);
|
||||
m_AppConfig.setUserToken(hashResult);
|
||||
m_AppConfig.setUserType(m_LoginResult);
|
||||
}
|
||||
}
|
||||
m_pMainWindow->show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
class MainWindow;
|
||||
class SetupWizard;
|
||||
class LoginAuth;
|
||||
class AppConfig;
|
||||
|
||||
class LoginWindow : public QMainWindow, public Ui::LoginWindow
|
||||
{
|
||||
|
@ -41,7 +40,6 @@ private:
|
|||
LoginAuth* m_pLoginAuth;
|
||||
int m_LoginResult;
|
||||
QString m_Error;
|
||||
AppConfig& m_AppConfig;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "DataDownloader.h"
|
||||
#include "CommandProcess.h"
|
||||
#include "LoginAuth.h"
|
||||
#include "LoginResult.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
|
|
|
@ -113,7 +113,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
|||
void serverDetected(const QString name);
|
||||
int checkWinArch();
|
||||
void setLoginResult(int result);
|
||||
AppConfig& appConfig() { return m_AppConfig; }
|
||||
|
||||
public slots:
|
||||
void appendLogRaw(const QString& text);
|
||||
|
@ -141,6 +140,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
|||
|
||||
protected:
|
||||
QSettings& settings() { return m_Settings; }
|
||||
AppConfig& appConfig() { return m_AppConfig; }
|
||||
QProcess*& synergyProcess() { return m_pSynergy; }
|
||||
void setSynergyProcess(QProcess* p) { m_pSynergy = p; }
|
||||
void initConnections();
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
#include "AppConfig.h"
|
||||
#include "SetupWizard.h"
|
||||
#include "LoginWindow.h"
|
||||
#include "QUtility.h"
|
||||
#include "LoginResult.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
|
@ -95,22 +93,13 @@ int main(int argc, char* argv[])
|
|||
|
||||
MainWindow mainWindow(settings, appConfig);
|
||||
SetupWizard setupWizard(mainWindow, true);
|
||||
LoginWindow loginWindow(
|
||||
&mainWindow,
|
||||
&setupWizard,
|
||||
appConfig.wizardShouldRun());
|
||||
|
||||
QString email = appConfig.userEmail();
|
||||
QString mac = getFirstMacAddress();
|
||||
QString hashSrc = email + mac;
|
||||
QString hashResult = hash(hashSrc);
|
||||
if (hashResult == appConfig.userToken()) {
|
||||
mainWindow.setLoginResult(appConfig.userType());
|
||||
mainWindow.show();
|
||||
}
|
||||
else {
|
||||
loginWindow.show();
|
||||
}
|
||||
LoginWindow loginWindow(
|
||||
&mainWindow,
|
||||
&setupWizard,
|
||||
appConfig.wizardShouldRun());
|
||||
|
||||
loginWindow.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue