Skip to content

Commit

Permalink
Add OAuthManager for OAuth and UserPass Scheme
Browse files Browse the repository at this point in the history
   First only for Xert
  • Loading branch information
grauser committed Dec 23, 2017
1 parent a7d4594 commit 2ccf423
Show file tree
Hide file tree
Showing 5 changed files with 873 additions and 17 deletions.
51 changes: 37 additions & 14 deletions src/Cloud/AddCloudWizard.cpp
Expand Up @@ -25,6 +25,7 @@
#include "Colors.h"
#include "CloudService.h"
#include "OAuthDialog.h"
#include "OAuthManager.h"

#include <QMessageBox>
#include <QRegExp>
Expand Down Expand Up @@ -314,20 +315,42 @@ AddAuth::doAuth()
// so they are up-to-date before we perform an OAUTH process
updateServiceSettings();

OAuthDialog *oauthDialog = new OAuthDialog(wizard->context, OAuthDialog::NONE, wizard->cloudService);
if (oauthDialog->sslLibMissing()) {
delete oauthDialog;
} else {
oauthDialog->setWindowModality(Qt::ApplicationModal);
oauthDialog->exec();
token->setText(wizard->cloudService->getSetting(cname, "").toString());

QString msg = wizard->cloudService->message;
if (msg != "") {
message->setText(msg);
messageLabel->show();
message->show();
wizard->cloudService->message = "";
if (wizard->cloudService->capabilities() & CloudService::OAuth) {
if (wizard->cloudService->capabilities() & CloudService::UserPass) {
OAuthManager *oauthManager = new OAuthManager(wizard->context, OAuthManager::NONE, wizard->cloudService);
if (oauthManager->sslLibMissing()) {
delete oauthManager;
} else {
messageLabel->show();
message->show();
message->setText(QString("Connecting with %1...").arg(wizard->cloudService->id()));
oauthManager->exec();
token->setText(wizard->cloudService->getSetting(cname, "").toString());

QString msg = wizard->cloudService->message;
if (msg != "") {
message->setText(msg);

wizard->cloudService->message = "";
}
}
} else {
OAuthDialog *oauthDialog = new OAuthDialog(wizard->context, OAuthDialog::NONE, wizard->cloudService);
if (oauthDialog->sslLibMissing()) {
delete oauthDialog;
} else {
oauthDialog->setWindowModality(Qt::ApplicationModal);
oauthDialog->exec();
token->setText(wizard->cloudService->getSetting(cname, "").toString());

QString msg = wizard->cloudService->message;
if (msg != "") {
message->setText(msg);
messageLabel->show();
message->show();
wizard->cloudService->message = "";
}
}
}
}

Expand Down

0 comments on commit 2ccf423

Please sign in to comment.