update login flow
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
6b1c4981e7
commit
c4a65dd861
@ -48,7 +48,6 @@
|
||||
#include <BaseInstance.h>
|
||||
|
||||
#include "minecraft/launch/MinecraftServerTarget.h"
|
||||
#include "ui/themes/CatPack.h"
|
||||
|
||||
class LaunchController;
|
||||
class LocalPeer;
|
||||
@ -193,6 +192,8 @@ class Application : public QApplication {
|
||||
void globalSettingsClosed();
|
||||
int currentCatChanged(int index);
|
||||
|
||||
void oauthReplyRecieved(QVariantMap);
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
void clickedOnDock();
|
||||
#endif
|
||||
|
@ -59,6 +59,9 @@ void AuthFlow::executeTask()
|
||||
|
||||
void AuthFlow::nextStep()
|
||||
{
|
||||
if (!Task::isRunning()) {
|
||||
return;
|
||||
}
|
||||
if (m_steps.size() == 0) {
|
||||
// we got to the end without an incident... assume this is all.
|
||||
m_currentStep.reset();
|
||||
@ -143,4 +146,11 @@ bool AuthFlow::changeState(AccountTaskState newState, QString reason)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool AuthFlow::abort()
|
||||
{
|
||||
emitAborted();
|
||||
if (m_currentStep)
|
||||
m_currentStep->abort();
|
||||
return true;
|
||||
}
|
@ -24,6 +24,9 @@ class AuthFlow : public Task {
|
||||
|
||||
AccountTaskState taskState() { return m_taskState; }
|
||||
|
||||
public slots:
|
||||
bool abort() override;
|
||||
|
||||
signals:
|
||||
void authorizeWithBrowser(const QUrl& url);
|
||||
void authorizeWithBrowserWithExtra(QString url, QString code, int expiresIn);
|
||||
|
@ -34,6 +34,7 @@ class AuthStep : public QObject {
|
||||
|
||||
public slots:
|
||||
virtual void perform() = 0;
|
||||
virtual void abort() {}
|
||||
|
||||
signals:
|
||||
void finished(AccountTaskState resultingState, QString message);
|
||||
|
@ -51,7 +51,7 @@ class MSADeviceCodeStep : public AuthStep {
|
||||
QString describe() override;
|
||||
|
||||
public slots:
|
||||
void abort();
|
||||
void abort() override;
|
||||
|
||||
signals:
|
||||
void authorizeWithBrowser(QString url, QString code, int expiresIn);
|
||||
|
@ -35,22 +35,35 @@
|
||||
|
||||
#include "MSAStep.h"
|
||||
|
||||
#include <QtNetworkAuth/qoauthhttpserverreplyhandler.h>
|
||||
#include <QAbstractOAuth2>
|
||||
#include <QNetworkRequest>
|
||||
#include <QOAuthOobReplyHandler>
|
||||
|
||||
#include "Application.h"
|
||||
#include "BuildConfig.h"
|
||||
|
||||
class CustomOAuthOobReplyHandler : public QOAuthOobReplyHandler {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CustomOAuthOobReplyHandler(QObject* parent = nullptr) : QOAuthOobReplyHandler(parent)
|
||||
{
|
||||
connect(APPLICATION, &Application::oauthReplyRecieved, this, &QOAuthOobReplyHandler::callbackReceived);
|
||||
}
|
||||
~CustomOAuthOobReplyHandler() override
|
||||
{
|
||||
disconnect(APPLICATION, &Application::oauthReplyRecieved, this, &QOAuthOobReplyHandler::callbackReceived);
|
||||
}
|
||||
QString callback() const override { return BuildConfig.LAUNCHER_APP_BINARY_NAME + "://oauth"; }
|
||||
};
|
||||
|
||||
MSAStep::MSAStep(AccountData* data, bool silent) : AuthStep(data), m_silent(silent)
|
||||
{
|
||||
m_clientId = APPLICATION->getMSAClientID();
|
||||
|
||||
auto replyHandler = new QOAuthHttpServerReplyHandler(1337, this);
|
||||
replyHandler->setCallbackText(
|
||||
" <iframe src=\"https://prismlauncher.org/successful-login\" title=\"PrismLauncher Microsoft login\" style=\"position:fixed; "
|
||||
"top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; "
|
||||
"z-index:999999;\"/> ");
|
||||
oauth2.setReplyHandler(replyHandler);
|
||||
auto bv = new CustomOAuthOobReplyHandler();
|
||||
|
||||
oauth2.setReplyHandler(bv);
|
||||
oauth2.setAuthorizationUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize"));
|
||||
oauth2.setAccessTokenUrl(QUrl("https://login.microsoftonline.com/consumers/oauth2/v2.0/token"));
|
||||
oauth2.setScope("XboxLive.SignIn XboxLive.offline_access");
|
||||
@ -106,3 +119,5 @@ void MSAStep::perform()
|
||||
oauth2.grant();
|
||||
}
|
||||
}
|
||||
|
||||
#include "MSAStep.moc"
|
@ -2,6 +2,7 @@
|
||||
<RCC version="1.0">
|
||||
<qresource prefix="/documents">
|
||||
<file>../../../COPYING.md</file>
|
||||
<file>login-qr.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
|
BIN
launcher/resources/documents/login-qr.png
Normal file
BIN
launcher/resources/documents/login-qr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
@ -996,6 +996,14 @@ void MainWindow::processURLs(QList<QUrl> urls)
|
||||
dlUrlDialod.execWithTask(job.get());
|
||||
}
|
||||
|
||||
} else if (url.scheme() == BuildConfig.LAUNCHER_APP_BINARY_NAME) {
|
||||
QVariantMap receivedData;
|
||||
const QUrlQuery query(url.query());
|
||||
const auto items = query.queryItems();
|
||||
for (auto it = items.begin(), end = items.end(); it != end; ++it)
|
||||
receivedData.insert(it->first, it->second);
|
||||
emit APPLICATION->oauthReplyRecieved(receivedData);
|
||||
continue;
|
||||
} else {
|
||||
dl_url = url;
|
||||
}
|
||||
|
@ -34,6 +34,8 @@
|
||||
*/
|
||||
|
||||
#include "MSALoginDialog.h"
|
||||
#include "Application.h"
|
||||
|
||||
#include "ui_MSALoginDialog.h"
|
||||
|
||||
#include "DesktopServices.h"
|
||||
@ -41,6 +43,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QPixmap>
|
||||
#include <QUrl>
|
||||
#include <QtWidgets/QPushButton>
|
||||
|
||||
@ -48,13 +51,18 @@ MSALoginDialog::MSALoginDialog(QWidget* parent) : QDialog(parent), ui(new Ui::MS
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->cancel->setEnabled(false);
|
||||
ui->link->setVisible(false);
|
||||
ui->copy->setVisible(false);
|
||||
ui->progressBar->setVisible(false);
|
||||
// make font monospace
|
||||
QFont font;
|
||||
font.setPixelSize(ui->code->fontInfo().pixelSize());
|
||||
font.setFamily(APPLICATION->settings()->get("ConsoleFont").toString());
|
||||
font.setStyleHint(QFont::Monospace);
|
||||
font.setFixedPitch(true);
|
||||
ui->code->setFont(font);
|
||||
|
||||
connect(ui->cancel, &QPushButton::pressed, this, &QDialog::reject);
|
||||
connect(ui->copy, &QPushButton::pressed, this, &MSALoginDialog::copyUrl);
|
||||
ui->buttonBox->button(QDialogButtonBox::Help)->setDefault(false);
|
||||
|
||||
connect(ui->copyCode, &QPushButton::clicked, this, [this] { QApplication::clipboard()->setText(ui->code->text()); });
|
||||
ui->qr->setPixmap(QPixmap(":/documents/login-qr.png"));
|
||||
}
|
||||
|
||||
int MSALoginDialog::exec()
|
||||
@ -63,12 +71,12 @@ int MSALoginDialog::exec()
|
||||
m_account = MinecraftAccount::createBlankMSA();
|
||||
m_task = m_account->login(m_using_device_code);
|
||||
connect(m_task.get(), &Task::failed, this, &MSALoginDialog::onTaskFailed);
|
||||
connect(m_task.get(), &Task::succeeded, this, &MSALoginDialog::onTaskSucceeded);
|
||||
connect(m_task.get(), &Task::succeeded, this, &QDialog::accept);
|
||||
connect(m_task.get(), &Task::aborted, this, &MSALoginDialog::reject);
|
||||
connect(m_task.get(), &Task::status, this, &MSALoginDialog::onTaskStatus);
|
||||
connect(m_task.get(), &AuthFlow::authorizeWithBrowser, this, &MSALoginDialog::authorizeWithBrowser);
|
||||
connect(m_task.get(), &AuthFlow::authorizeWithBrowserWithExtra, this, &MSALoginDialog::authorizeWithBrowserWithExtra);
|
||||
connect(ui->cancel, &QPushButton::pressed, m_task.get(), &Task::abort);
|
||||
connect(&m_external_timer, &QTimer::timeout, this, &MSALoginDialog::externalLoginTick);
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, m_task.get(), &Task::abort);
|
||||
m_task->start();
|
||||
|
||||
return QDialog::exec();
|
||||
@ -79,9 +87,10 @@ MSALoginDialog::~MSALoginDialog()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MSALoginDialog::onTaskFailed(const QString& reason)
|
||||
void MSALoginDialog::onTaskFailed(QString reason)
|
||||
{
|
||||
// Set message
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
auto lines = reason.split('\n');
|
||||
QString processed;
|
||||
for (auto line : lines) {
|
||||
@ -91,91 +100,55 @@ void MSALoginDialog::onTaskFailed(const QString& reason)
|
||||
processed += "<br />";
|
||||
}
|
||||
}
|
||||
ui->message->setText(processed);
|
||||
}
|
||||
|
||||
void MSALoginDialog::onTaskSucceeded()
|
||||
{
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void MSALoginDialog::onTaskStatus(const QString& status)
|
||||
{
|
||||
ui->message->setText(status);
|
||||
ui->cancel->setEnabled(false);
|
||||
ui->link->setVisible(false);
|
||||
ui->copy->setVisible(false);
|
||||
ui->progressBar->setVisible(false);
|
||||
}
|
||||
|
||||
// Public interface
|
||||
MinecraftAccountPtr MSALoginDialog::newAccount(QWidget* parent, QString msg, bool usingDeviceCode)
|
||||
{
|
||||
MSALoginDialog dlg(parent);
|
||||
dlg.m_using_device_code = usingDeviceCode;
|
||||
dlg.ui->message->setText(msg);
|
||||
if (dlg.exec() == QDialog::Accepted) {
|
||||
return dlg.m_account;
|
||||
}
|
||||
return nullptr;
|
||||
ui->status->setText(processed);
|
||||
ui->loadingLabel->setText(m_task->getStatus());
|
||||
disconnect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, m_task.get(), &Task::abort);
|
||||
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &MSALoginDialog::reject);
|
||||
}
|
||||
|
||||
void MSALoginDialog::authorizeWithBrowser(const QUrl& url)
|
||||
{
|
||||
ui->cancel->setEnabled(true);
|
||||
ui->link->setVisible(true);
|
||||
ui->copy->setVisible(true);
|
||||
ui->stackedWidget->setCurrentIndex(2);
|
||||
DesktopServices::openUrl(url);
|
||||
ui->link->setText(url.toDisplayString());
|
||||
ui->message->setText(
|
||||
const auto uri = url.toString();
|
||||
const auto linkString = QString("<a href=\"%1\">%2</a>").arg(uri, uri);
|
||||
ui->urlInfo->setText(
|
||||
tr("Browser opened to complete the login process."
|
||||
"<br /><br />"
|
||||
"If your browser hasn't opened, please manually open the below link in your browser:"));
|
||||
}
|
||||
|
||||
void MSALoginDialog::copyUrl()
|
||||
{
|
||||
QClipboard* cb = QApplication::clipboard();
|
||||
cb->setText(ui->link->text());
|
||||
"If your browser hasn't opened, please manually open the following link and choose your account:</p>"));
|
||||
ui->url->setText(linkString);
|
||||
}
|
||||
|
||||
void MSALoginDialog::authorizeWithBrowserWithExtra(QString url, QString code, int expiresIn)
|
||||
{
|
||||
m_external_elapsed = 0;
|
||||
m_external_timeout = expiresIn;
|
||||
ui->stackedWidget->setCurrentIndex(1);
|
||||
|
||||
m_external_timer.setInterval(1000);
|
||||
m_external_timer.setSingleShot(false);
|
||||
m_external_timer.start();
|
||||
const auto linkString = QString("<a href=\"%1\">%2</a>").arg(url, url);
|
||||
ui->code->setText(code);
|
||||
ui->codeInfo->setText(tr("<p>Enter this code into %1 and choose your account.</p>").arg(linkString));
|
||||
|
||||
ui->progressBar->setMaximum(expiresIn);
|
||||
ui->progressBar->setValue(m_external_elapsed);
|
||||
const auto isDefaultUrl = url == "https://www.microsoft.com/link";
|
||||
|
||||
QString linkString = QString("<a href=\"%1\">%2</a>").arg(url, url);
|
||||
if (url == "https://www.microsoft.com/link" && !code.isEmpty()) {
|
||||
ui->qr->setVisible(isDefaultUrl);
|
||||
if (isDefaultUrl && !code.isEmpty()) {
|
||||
url += QString("?otc=%1").arg(code);
|
||||
ui->message->setText(tr("<p>Please login in the opened browser. If no browser was opened, please open up %1 in "
|
||||
"a browser and put in the code <b>%2</b> to proceed with login.</p>")
|
||||
.arg(linkString, code));
|
||||
} else {
|
||||
ui->message->setText(
|
||||
tr("<p>Please open up %1 in a browser and put in the code <b>%2</b> to proceed with login.</p>").arg(linkString, code));
|
||||
}
|
||||
ui->cancel->setEnabled(true);
|
||||
ui->link->setVisible(true);
|
||||
ui->copy->setVisible(true);
|
||||
ui->progressBar->setVisible(true);
|
||||
DesktopServices::openUrl(url);
|
||||
ui->link->setText(code);
|
||||
}
|
||||
|
||||
void MSALoginDialog::externalLoginTick()
|
||||
void MSALoginDialog::onTaskStatus(QString status)
|
||||
{
|
||||
m_external_elapsed++;
|
||||
ui->progressBar->setValue(m_external_elapsed);
|
||||
ui->progressBar->repaint();
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
ui->status->setText(status);
|
||||
}
|
||||
|
||||
if (m_external_elapsed >= m_external_timeout) {
|
||||
m_external_timer.stop();
|
||||
// Public interface
|
||||
MinecraftAccountPtr MSALoginDialog::newAccount(QWidget* parent, bool usingDeviceCode)
|
||||
{
|
||||
MSALoginDialog dlg(parent);
|
||||
dlg.m_using_device_code = usingDeviceCode;
|
||||
if (dlg.exec() == QDialog::Accepted) {
|
||||
return dlg.m_account;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
@ -32,29 +32,22 @@ class MSALoginDialog : public QDialog {
|
||||
public:
|
||||
~MSALoginDialog();
|
||||
|
||||
static MinecraftAccountPtr newAccount(QWidget* parent, QString message, bool usingDeviceCode = false);
|
||||
static MinecraftAccountPtr newAccount(QWidget* parent, bool usingDeviceCode = false);
|
||||
int exec() override;
|
||||
|
||||
private:
|
||||
explicit MSALoginDialog(QWidget* parent = 0);
|
||||
|
||||
protected slots:
|
||||
void onTaskFailed(const QString& reason);
|
||||
void onTaskSucceeded();
|
||||
void onTaskStatus(const QString& status);
|
||||
void onTaskFailed(QString reason);
|
||||
void onTaskStatus(QString status);
|
||||
void authorizeWithBrowser(const QUrl& url);
|
||||
void authorizeWithBrowserWithExtra(QString url, QString code, int expiresIn);
|
||||
void copyUrl();
|
||||
void externalLoginTick();
|
||||
|
||||
private:
|
||||
Ui::MSALoginDialog* ui;
|
||||
MinecraftAccountPtr m_account;
|
||||
shared_qobject_ptr<AuthFlow> m_task;
|
||||
|
||||
int m_external_elapsed;
|
||||
int m_external_timeout;
|
||||
QTimer m_external_timer;
|
||||
|
||||
bool m_using_device_code = false;
|
||||
};
|
||||
|
@ -6,90 +6,337 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>491</width>
|
||||
<height>208</height>
|
||||
<width>500</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Add Microsoft Account</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="message">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>500</width>
|
||||
<height>500</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="loadingPage">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="loadingLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Please wait...</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="status">
|
||||
<property name="text">
|
||||
<string>Status</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="codePage">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<spacer name="verticalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="code">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>40</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CODE</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="copyCode">
|
||||
<property name="toolTip">
|
||||
<string>Copy code to clipboard</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="copy">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="codeInfo">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>false</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Information</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="qr">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>:/assets/login-qr.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="urlPage">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="urlInfo">
|
||||
<property name="font">
|
||||
<font>
|
||||
<italic>false</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Information</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="url">
|
||||
<property name="text">
|
||||
<string>url</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="linkLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="link">
|
||||
<property name="readOnly">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="copy">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="copy">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help</set>
|
||||
</property>
|
||||
<property name="textVisible">
|
||||
<property name="centerButtons">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
@ -134,15 +134,14 @@ void AccountListPage::on_actionAddMicrosoft_triggered()
|
||||
box.setWindowTitle(tr("Add account"));
|
||||
box.setText(tr("How do you want to login?"));
|
||||
box.setIcon(QMessageBox::Question);
|
||||
auto deviceCode = box.addButton(tr("Legacy"), QMessageBox::ButtonRole::YesRole);
|
||||
auto deviceCode = box.addButton(tr("Remote"), QMessageBox::ButtonRole::YesRole);
|
||||
auto authCode = box.addButton(tr("Recommended"), QMessageBox::ButtonRole::NoRole);
|
||||
auto cancel = box.addButton(tr("Cancel"), QMessageBox::ButtonRole::RejectRole);
|
||||
box.setDefaultButton(authCode);
|
||||
box.exec();
|
||||
if ((box.clickedButton() != deviceCode && box.clickedButton() != authCode) || box.clickedButton() == cancel)
|
||||
return;
|
||||
MinecraftAccountPtr account = MSALoginDialog::newAccount(
|
||||
this, tr("Please enter your Mojang account email and password to add your account."), box.clickedButton() == deviceCode);
|
||||
MinecraftAccountPtr account = MSALoginDialog::newAccount(this, box.clickedButton() == deviceCode);
|
||||
|
||||
if (account) {
|
||||
m_accounts->addAccount(account);
|
||||
|
@ -10,4 +10,4 @@ Icon=org.prismlauncher.PrismLauncher
|
||||
Categories=Game;ActionGame;AdventureGame;Simulation;
|
||||
Keywords=game;minecraft;mc;
|
||||
StartupWMClass=PrismLauncher
|
||||
MimeType=application/zip;application/x-modrinth-modpack+zip;x-scheme-handler/curseforge;
|
||||
MimeType=application/zip;application/x-modrinth-modpack+zip;x-scheme-handler/curseforge;x-scheme-handler/prismlauncher;
|
||||
|
@ -368,6 +368,10 @@ Section "@Launcher_DisplayName@"
|
||||
WriteRegStr HKCU Software\Classes\curseforge "URL Protocol" ""
|
||||
WriteRegStr HKCU Software\Classes\curseforge\shell\open\command "" '"$INSTDIR\@Launcher_APP_BINARY_NAME@.exe" "%1"'
|
||||
|
||||
; Write the URL Handler into registry for prismlauncher
|
||||
WriteRegStr HKCU Software\Classes\prismlauncher "URL Protocol" ""
|
||||
WriteRegStr HKCU Software\Classes\prismlauncher\shell\open\command "" '"$INSTDIR\@Launcher_APP_BINARY_NAME@.exe" "%1"'
|
||||
|
||||
; Write the uninstall keys for Windows
|
||||
${GetParameters} $R0
|
||||
${GetOptions} $R0 "/NoUninstaller" $R1
|
||||
|
Loading…
Reference in New Issue
Block a user