mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-26 12:41:35 +03:00
parent
c25b6a8bf6
commit
097f4c4c1f
@ -14,8 +14,7 @@ FORMS += res/MainWindowBase.ui \
|
||||
res/HotkeyDialogBase.ui \
|
||||
res/SettingsDialogBase.ui \
|
||||
res/SetupWizardBase.ui \
|
||||
res/AddClientDialogBase.ui \
|
||||
res/LoginWindowBase.ui
|
||||
res/AddClientDialogBase.ui
|
||||
SOURCES += src/main.cpp \
|
||||
src/MainWindow.cpp \
|
||||
src/AboutDialog.cpp \
|
||||
@ -51,9 +50,7 @@ SOURCES += src/main.cpp \
|
||||
src/ZeroconfService.cpp \
|
||||
src/DataDownloader.cpp \
|
||||
src/AddClientDialog.cpp \
|
||||
src/CommandProcess.cpp \
|
||||
src/LoginWindow.cpp \
|
||||
src/LoginAuth.cpp
|
||||
src/CommandProcess.cpp
|
||||
HEADERS += src/MainWindow.h \
|
||||
src/AboutDialog.h \
|
||||
src/ServerConfig.h \
|
||||
@ -89,9 +86,7 @@ HEADERS += src/MainWindow.h \
|
||||
src/ZeroconfService.h \
|
||||
src/DataDownloader.h \
|
||||
src/AddClientDialog.h \
|
||||
src/CommandProcess.h \
|
||||
src/LoginWindow.h \
|
||||
src/LoginAuth.h
|
||||
src/CommandProcess.h
|
||||
RESOURCES += res/Synergy.qrc
|
||||
RC_FILE = res/win/Synergy.rc
|
||||
macx {
|
||||
|
@ -1,22 +0,0 @@
|
||||
#ifndef LOGINWINDOW_H
|
||||
#define LOGINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "ui_LoginWindowBase.h"
|
||||
|
||||
class LoginWindow : public QMainWindow, public Ui::LoginWindowBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LoginWindow(QWidget *parent = 0);
|
||||
~LoginWindow();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
Ui::LoginWindow *ui;
|
||||
};
|
||||
|
||||
#endif // LOGINWINDOW_H
|
@ -1,149 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LoginWindow</class>
|
||||
<widget class="QMainWindow" name="LoginWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>200</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Synergy</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="Synergy.qrc">:/res/image/about.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="leftMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_pLabelEmail">
|
||||
<property name="text">
|
||||
<string>Email:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_pLineEditEmail">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="m_pLabelPassword">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="m_pLineEditPassword">
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhHiddenText</set>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_pLabelRegister">
|
||||
<property name="text">
|
||||
<string><a href="http://synergy-project.org/">Register</a></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pPushButtonLogin">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Login</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Return</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pPushButtonCancel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Esc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="Synergy.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,102 +0,0 @@
|
||||
#include "LoginAuth.h"
|
||||
|
||||
#include "LoginWindow.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QCoreApplication>
|
||||
#include <QCryptographicHash>
|
||||
#include <stdexcept>
|
||||
|
||||
void LoginAuth::checkUserType()
|
||||
{
|
||||
int result = doCheckUserType();
|
||||
m_pLoginWindow->setLoginResult(result);
|
||||
emit finished();
|
||||
}
|
||||
|
||||
int LoginAuth::doCheckUserType()
|
||||
{
|
||||
QString responseJson;
|
||||
|
||||
try
|
||||
{
|
||||
responseJson = request(m_Email, m_Password);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
m_pLoginWindow->setError(e.what());
|
||||
return ExceptionError;
|
||||
}
|
||||
|
||||
QRegExp resultRegex(".*\"result\".*:.*(true|false).*");
|
||||
if (resultRegex.exactMatch(responseJson)) {
|
||||
QString boolString = resultRegex.cap(1);
|
||||
if (boolString == "true") {
|
||||
return Home;
|
||||
}
|
||||
else if (boolString == "false") {
|
||||
return InvalidEmailPassword;
|
||||
}
|
||||
}
|
||||
else {
|
||||
QRegExp errorRegex(".*\"error\".*:.*\"(.+)\".*");
|
||||
if (errorRegex.exactMatch(responseJson)) {
|
||||
|
||||
// replace "\n" with real new lines.
|
||||
QString error = errorRegex.cap(1).replace("\\n", "\n");
|
||||
m_pLoginWindow->setError(error);
|
||||
return Error;
|
||||
}
|
||||
}
|
||||
|
||||
m_pLoginWindow->setError(responseJson);
|
||||
return ServerResponseError;
|
||||
}
|
||||
|
||||
QString LoginAuth::request(const QString& email, const QString& password)
|
||||
{
|
||||
QString program(QCoreApplication::applicationDirPath() + "/syntool");
|
||||
QStringList args("--login-auth");
|
||||
|
||||
QProcess process;
|
||||
process.setReadChannel(QProcess::StandardOutput);
|
||||
process.start(program, args);
|
||||
bool success = process.waitForStarted();
|
||||
|
||||
QString out, error;
|
||||
if (success)
|
||||
{
|
||||
// hash password in case it contains interesting chars.
|
||||
QString credentials(email + ":" + hash(password) + "\n");
|
||||
process.write(credentials.toStdString().c_str());
|
||||
|
||||
if (process.waitForFinished()) {
|
||||
out = process.readAllStandardOutput();
|
||||
error = process.readAllStandardError();
|
||||
}
|
||||
}
|
||||
|
||||
out = out.trimmed();
|
||||
error = error.trimmed();
|
||||
|
||||
if (out.isEmpty() ||
|
||||
!error.isEmpty() ||
|
||||
!success ||
|
||||
process.exitCode() != 0)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
QString("Code: %1\nError: %2")
|
||||
.arg(process.exitCode())
|
||||
.arg(error.isEmpty() ? "Unknown" : error)
|
||||
.toStdString());
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
QString LoginAuth::hash(const QString& string)
|
||||
{
|
||||
QByteArray data = string.toUtf8();
|
||||
QByteArray hash = QCryptographicHash::hash(data, QCryptographicHash::Md5);
|
||||
return hash.toHex();
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
#ifndef LOGINAUTH_H
|
||||
#define LOGINAUTH_H
|
||||
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
|
||||
class LoginWindow;
|
||||
|
||||
enum qUserType {
|
||||
Student,
|
||||
Home,
|
||||
Professional,
|
||||
Error,
|
||||
ExceptionError,
|
||||
InvalidEmailPassword,
|
||||
ServerResponseError,
|
||||
Unknown
|
||||
|
||||
};
|
||||
|
||||
class LoginAuth : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
int doCheckUserType();
|
||||
void setEmail(QString email) { m_Email = email; }
|
||||
void setPassword(QString password) { m_Password = password; }
|
||||
void setLoginWindow(LoginWindow* w) { m_pLoginWindow = w; }
|
||||
|
||||
public slots:
|
||||
void checkUserType();
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
|
||||
private:
|
||||
QString request(const QString& email, const QString& password);
|
||||
QString hash(const QString& string);
|
||||
|
||||
private:
|
||||
QString m_Email;
|
||||
QString m_Password;
|
||||
LoginWindow* m_pLoginWindow;
|
||||
};
|
||||
|
||||
#endif // LOGINAUTH_H
|
@ -1,144 +0,0 @@
|
||||
#include "LoginWindow.h"
|
||||
#include "ui_LoginWindowBase.h"
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "SetupWizard.h"
|
||||
#include "LoginAuth.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QThread>
|
||||
|
||||
LoginWindow::LoginWindow(
|
||||
MainWindow* mainWindow,
|
||||
SetupWizard* setupWizard,
|
||||
bool wizardShouldRun,
|
||||
QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
m_pMainWindow(mainWindow),
|
||||
m_pSetupWizard(setupWizard),
|
||||
m_WizardShouldRun(wizardShouldRun),
|
||||
m_pLoginAuth(NULL),
|
||||
m_LoginResult(Unknown)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
LoginWindow::~LoginWindow()
|
||||
{
|
||||
if (m_pLoginAuth != NULL) {
|
||||
delete m_pLoginAuth;
|
||||
}
|
||||
}
|
||||
|
||||
void LoginWindow::showNext()
|
||||
{
|
||||
if (m_LoginResult == ExceptionError) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Error"),
|
||||
tr("Sorry, an error occured while trying to sign in. "
|
||||
"Please contact the help desk, and provide the "
|
||||
"following details.\n\n%1").arg(m_Error));
|
||||
}
|
||||
else if (m_LoginResult == InvalidEmailPassword) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Error"),
|
||||
tr("Login failed, invalid email or password."));
|
||||
}
|
||||
else if (m_LoginResult == Error) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Error"),
|
||||
tr("Login failed, an error occurred.\n\n%1").arg(m_Error));
|
||||
}
|
||||
else if (m_LoginResult == ServerResponseError) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
"Error",
|
||||
tr("Login failed, an error occurred.\n\nServer response:\n\n%1")
|
||||
.arg(m_Error));
|
||||
}
|
||||
else {
|
||||
hide();
|
||||
if (m_WizardShouldRun) {
|
||||
m_pSetupWizard->show();
|
||||
}
|
||||
else {
|
||||
m_pMainWindow->setLoginResult(m_LoginResult);
|
||||
m_pMainWindow->show();
|
||||
}
|
||||
}
|
||||
|
||||
delete m_pLoginAuth;
|
||||
m_pLoginAuth = NULL;
|
||||
m_LoginResult = Unknown;
|
||||
m_pPushButtonLogin->setText("Login");
|
||||
m_pPushButtonLogin->setDefault(true);
|
||||
}
|
||||
|
||||
bool LoginWindow::validEmailPassword()
|
||||
{
|
||||
if (m_pLineEditEmail->text().isEmpty() ||
|
||||
m_pLineEditPassword->text().isEmpty()) {
|
||||
QMessageBox::warning(
|
||||
this,
|
||||
"Warning",
|
||||
tr("Please fill in your email and password."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void LoginWindow::changeEvent(QEvent *e)
|
||||
{
|
||||
QMainWindow::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
void LoginWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
event->accept();
|
||||
showNext();
|
||||
}
|
||||
|
||||
void LoginWindow::on_m_pPushButtonLogin_clicked()
|
||||
{
|
||||
if (validEmailPassword()) {
|
||||
if (m_pLoginAuth == NULL) {
|
||||
m_pLoginAuth = new LoginAuth();
|
||||
m_pLoginAuth->setLoginWindow(this);
|
||||
}
|
||||
|
||||
m_pPushButtonLogin->setText("Logging...");
|
||||
|
||||
QString email = m_pLineEditEmail->text();
|
||||
QString password = m_pLineEditPassword->text();
|
||||
m_pLoginAuth->setEmail(email);
|
||||
m_pLoginAuth->setPassword(password);
|
||||
|
||||
QThread* thread = new QThread;
|
||||
connect(m_pLoginAuth, SIGNAL(finished()), this, SLOT(showNext()));
|
||||
connect(m_pLoginAuth, SIGNAL(finished()), thread, SLOT(quit()));
|
||||
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||
|
||||
m_pLoginAuth->moveToThread(thread);
|
||||
thread->start();
|
||||
|
||||
QMetaObject::invokeMethod(m_pLoginAuth, "checkUserType", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
void LoginWindow::on_m_pPushButtonCancel_clicked()
|
||||
{
|
||||
showNext();
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
#ifndef LOGINWINDOW_H
|
||||
#define LOGINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "ui_LoginWindowBase.h"
|
||||
|
||||
class MainWindow;
|
||||
class SetupWizard;
|
||||
class LoginAuth;
|
||||
|
||||
class LoginWindow : public QMainWindow, public Ui::LoginWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LoginWindow(MainWindow* mainWindow,
|
||||
SetupWizard* setupWizard,
|
||||
bool wizardShouldRun,
|
||||
QWidget *parent = 0);
|
||||
~LoginWindow();
|
||||
|
||||
void setLoginResult(int result) { m_LoginResult = result; }
|
||||
void setError(QString error) { m_Error = error; }
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
private slots:
|
||||
void on_m_pPushButtonCancel_clicked();
|
||||
void on_m_pPushButtonLogin_clicked();
|
||||
void showNext();
|
||||
|
||||
private:
|
||||
bool validEmailPassword();
|
||||
private:
|
||||
MainWindow* m_pMainWindow;
|
||||
SetupWizard* m_pSetupWizard;
|
||||
bool m_WizardShouldRun;
|
||||
LoginAuth* m_pLoginAuth;
|
||||
int m_LoginResult;
|
||||
QString m_Error;
|
||||
|
||||
};
|
||||
|
||||
#endif // LOGINWINDOW_H
|
@ -28,7 +28,6 @@
|
||||
#include "ZeroconfService.h"
|
||||
#include "DataDownloader.h"
|
||||
#include "CommandProcess.h"
|
||||
#include "LoginAuth.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
@ -90,8 +89,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
||||
m_pCancelButton(NULL),
|
||||
m_SuppressAutoConfigWarning(false),
|
||||
m_BonjourInstall(NULL),
|
||||
m_SuppressEmptyServerWarning(false),
|
||||
m_LoginResult(Unknown)
|
||||
m_SuppressEmptyServerWarning(false)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
@ -568,10 +566,7 @@ QString MainWindow::configFilename()
|
||||
m_pTempConfigFile = new QTemporaryFile();
|
||||
if (!m_pTempConfigFile->open())
|
||||
{
|
||||
QMessageBox::critical(
|
||||
this, tr("Cannot write configuration file"),
|
||||
tr("The temporary configuration file required to start synergy can not be written."));
|
||||
|
||||
QMessageBox::critical(this, tr("Cannot write configuration file"), tr("The temporary configuration file required to start synergy can not be written."));
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -877,26 +872,6 @@ int MainWindow::checkWinArch()
|
||||
return unknown;
|
||||
}
|
||||
|
||||
void MainWindow::setLoginResult(int result)
|
||||
{
|
||||
m_LoginResult = result;
|
||||
QString title;
|
||||
if (result == Student) {
|
||||
title = "Synergy Student";
|
||||
}
|
||||
else if (result == Home) {
|
||||
title = "Synergy Home";
|
||||
}
|
||||
else if (result == Professional) {
|
||||
title = "Synergy Pro";
|
||||
}
|
||||
else {
|
||||
title = "Synergy (UNREGISTERED)";
|
||||
}
|
||||
|
||||
setWindowTitle(title);
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pGroupClient_toggled(bool on)
|
||||
{
|
||||
m_pGroupServer->setChecked(!on);
|
||||
|
@ -112,7 +112,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
void updateZeroconfService();
|
||||
void serverDetected(const QString name);
|
||||
int checkWinArch();
|
||||
void setLoginResult(int result);
|
||||
|
||||
public slots:
|
||||
void appendLogRaw(const QString& text);
|
||||
@ -193,7 +192,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||
bool m_SuppressAutoConfigWarning;
|
||||
CommandProcess* m_BonjourInstall;
|
||||
bool m_SuppressEmptyServerWarning;
|
||||
int m_LoginResult;
|
||||
|
||||
private slots:
|
||||
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "MainWindow.h"
|
||||
#include "AppConfig.h"
|
||||
#include "SetupWizard.h"
|
||||
#include "LoginWindow.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
@ -94,12 +93,14 @@ int main(int argc, char* argv[])
|
||||
MainWindow mainWindow(settings, appConfig);
|
||||
SetupWizard setupWizard(mainWindow, true);
|
||||
|
||||
LoginWindow loginWindow(
|
||||
&mainWindow,
|
||||
&setupWizard,
|
||||
appConfig.wizardShouldRun());
|
||||
|
||||
loginWindow.show();
|
||||
if (appConfig.wizardShouldRun())
|
||||
{
|
||||
setupWizard.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
mainWindow.open();
|
||||
}
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -160,20 +160,17 @@ ArgParser::parsePlatformArg(ArgsBase& argsBase, const int& argc, const char* con
|
||||
bool
|
||||
ArgParser::parseToolArgs(ToolArgs& args, int argc, const char* const* argv)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (isArg(i, argc, argv, NULL, "--get-active-desktop", 0)) {
|
||||
args.m_printActiveDesktopName = true;
|
||||
result = true;
|
||||
return true;
|
||||
}
|
||||
if (isArg(i, argc, argv, NULL, "--login-auth", 0)) {
|
||||
args.m_loginAuthenticate = true;
|
||||
result = true;
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -29,8 +29,6 @@
|
||||
#include "platform/MSWindowsSession.h"
|
||||
#endif
|
||||
|
||||
#define PREMIUM_AUTH_URL "https://synergy-project.org/premium/json/auth/"
|
||||
|
||||
enum {
|
||||
kErrorOk,
|
||||
kErrorArgs,
|
||||
@ -67,9 +65,6 @@ ToolApp::run(int argc, char** argv)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (m_args.m_loginAuthenticate) {
|
||||
loginAuth();
|
||||
}
|
||||
else {
|
||||
throw XSynergy("Nothing to do");
|
||||
}
|
||||
@ -90,21 +85,3 @@ void
|
||||
ToolApp::help()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ToolApp::loginAuth()
|
||||
{
|
||||
String credentials;
|
||||
std::cin >> credentials;
|
||||
|
||||
size_t separator = credentials.find(':');
|
||||
String email = credentials.substr(0, separator);
|
||||
String password = credentials.substr(separator + 1, credentials.length());
|
||||
|
||||
std::stringstream ss;
|
||||
ss << PREMIUM_AUTH_URL;
|
||||
ss << "?email=" << ARCH->internet().urlEncode(email);
|
||||
ss << "&password=" << password;
|
||||
|
||||
std::cout << ARCH->internet().get(ss.str()) << std::endl;
|
||||
}
|
||||
|
@ -26,10 +26,6 @@ class ToolApp : public MinimalApp
|
||||
public:
|
||||
UInt32 run(int argc, char** argv);
|
||||
void help();
|
||||
|
||||
private:
|
||||
void loginAuth();
|
||||
|
||||
private:
|
||||
ToolArgs m_args;
|
||||
};
|
||||
|
@ -25,5 +25,4 @@ public:
|
||||
|
||||
public:
|
||||
bool m_printActiveDesktopName;
|
||||
bool m_loginAuthenticate;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user