From c4a65dd861f0704f09f258c5cc9c5530e5db981a Mon Sep 17 00:00:00 2001
From: Trial97
Date: Wed, 12 Jun 2024 00:34:39 +0300
Subject: [PATCH] update login flow
Signed-off-by: Trial97
---
launcher/Application.h | 3 +-
launcher/minecraft/auth/AuthFlow.cpp | 10 +
launcher/minecraft/auth/AuthFlow.h | 3 +
launcher/minecraft/auth/AuthStep.h | 1 +
.../minecraft/auth/steps/MSADeviceCodeStep.h | 2 +-
launcher/minecraft/auth/steps/MSAStep.cpp | 29 +-
launcher/resources/documents/documents.qrc | 1 +
launcher/resources/documents/login-qr.png | Bin 0 -> 7616 bytes
launcher/ui/MainWindow.cpp | 8 +
launcher/ui/dialogs/MSALoginDialog.cpp | 123 +++---
launcher/ui/dialogs/MSALoginDialog.h | 13 +-
launcher/ui/dialogs/MSALoginDialog.ui | 383 ++++++++++++++----
launcher/ui/pages/global/AccountListPage.cpp | 5 +-
...org.prismlauncher.PrismLauncher.desktop.in | 2 +-
program_info/win_install.nsi.in | 4 +
15 files changed, 421 insertions(+), 166 deletions(-)
create mode 100644 launcher/resources/documents/login-qr.png
diff --git a/launcher/Application.h b/launcher/Application.h
index 7669e08ec..8303c7475 100644
--- a/launcher/Application.h
+++ b/launcher/Application.h
@@ -48,7 +48,6 @@
#include
#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
diff --git a/launcher/minecraft/auth/AuthFlow.cpp b/launcher/minecraft/auth/AuthFlow.cpp
index 5648fe9f6..45926206c 100644
--- a/launcher/minecraft/auth/AuthFlow.cpp
+++ b/launcher/minecraft/auth/AuthFlow.cpp
@@ -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;
}
\ No newline at end of file
diff --git a/launcher/minecraft/auth/AuthFlow.h b/launcher/minecraft/auth/AuthFlow.h
index d99deec3c..4d18ac845 100644
--- a/launcher/minecraft/auth/AuthFlow.h
+++ b/launcher/minecraft/auth/AuthFlow.h
@@ -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);
diff --git a/launcher/minecraft/auth/AuthStep.h b/launcher/minecraft/auth/AuthStep.h
index 4d2cf69c1..a2b2cf9e5 100644
--- a/launcher/minecraft/auth/AuthStep.h
+++ b/launcher/minecraft/auth/AuthStep.h
@@ -34,6 +34,7 @@ class AuthStep : public QObject {
public slots:
virtual void perform() = 0;
+ virtual void abort() {}
signals:
void finished(AccountTaskState resultingState, QString message);
diff --git a/launcher/minecraft/auth/steps/MSADeviceCodeStep.h b/launcher/minecraft/auth/steps/MSADeviceCodeStep.h
index e53eebc62..024927b31 100644
--- a/launcher/minecraft/auth/steps/MSADeviceCodeStep.h
+++ b/launcher/minecraft/auth/steps/MSADeviceCodeStep.h
@@ -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);
diff --git a/launcher/minecraft/auth/steps/MSAStep.cpp b/launcher/minecraft/auth/steps/MSAStep.cpp
index 3f31cdc16..c1eb3a33c 100644
--- a/launcher/minecraft/auth/steps/MSAStep.cpp
+++ b/launcher/minecraft/auth/steps/MSAStep.cpp
@@ -35,22 +35,35 @@
#include "MSAStep.h"
-#include
#include
#include
+#include
#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(
- " ");
- 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"
\ No newline at end of file
diff --git a/launcher/resources/documents/documents.qrc b/launcher/resources/documents/documents.qrc
index 007efcde3..a5ff84390 100644
--- a/launcher/resources/documents/documents.qrc
+++ b/launcher/resources/documents/documents.qrc
@@ -2,6 +2,7 @@
../../../COPYING.md
+ login-qr.png
diff --git a/launcher/resources/documents/login-qr.png b/launcher/resources/documents/login-qr.png
new file mode 100644
index 0000000000000000000000000000000000000000..9bed0a73e2e456fd810cdc997dbf0db24dcafc1c
GIT binary patch
literal 7616
zcmeHMdrVVT7(ZAChJgf^DBYxU5?^tY4a7R2fR52QCg?ync`3|_3Rno(+FrCGNaiGv
zg<4WxB|&5+6tG%QXr&AkwJlX}od{g&bcL>zf)#tUJa%r)k|kz;En9MvrD^X;d(-CY
z_nqJCoZT7CaCd#z6#(GA{qu;g09agrKbI_m?=TM^s)ZNl)F?&-Sim2(iiR=(ypL^<
z*cx}dYGSA>b2xli_u_JRkNOI@-BIg$LB9#*zKib`OKCKMW(k{9@p9Z
z8b#JPhn;m1b_u-be!H=)26~HQhy`=LV%w7;a+0B#niE;B3HH&uO!El?HE-Zy0%92m
z0Bu(w&-`?bX@T&|MfPoGDaJ0N%1$MXxSUUq_L$<~I}+!YK{7M3-JVlQ%`s9{)TCSf
ziJL9O2H$SE3mdJst{f4w2;RZjxOB;YkNlffx54@==+p@-dQ8Oi+wG-h6{%*MI@H8(
zJV4*qdd#0ENJkcX5|i7a-~VI!Tf1YNu)KZIeUvB*{TnSJB)iR~(BRC#tOwuwb1@~l2W
z#5MVTjj{^T-XfJ0>0u7?w8;Ky&%9B2XN$GQr@7W%XtBLroti%SEzKs9l6%N^#Kra
z5JWrFu9nXj{8>e?jmo~E_F|%QSDlsUO@LLk%>f-rNtgT01kL~0x
zw$V_%>lO(SNjf^YDo{Y=3T3uXdUuQrdgP~+k$tUhq6||Aqg>$q_Yx|exj3fD61fOtAY~9+)F@37SQX%_@a!fp1>LxQD5!i=3d6eK
zIxaLBA+SPKmWaSGid0d+egV#eGF=NP8|Oeyq-df)n=gDk55qXQLO~a62V%4O?RI-_
zZ?AC!09eZ3q;z1a8w(?tuY_h&`HL>Tfq`AZqaN&%G%8JD(dOjx2XhXPsn#ZlKYXm}
z{v44J2+E#Q!SN3N@dDN4L$O-ziOW~0$)P$ZOKRuZ4xwa1qtKs;^MDT&1$%N&2cmkv!{guEH
z;a@qvnr)s7S`Lp)fY(zN{ag~$6DT!!EPoW=16ct$4^`r)55r%=BNhEYJO-rUgK$j*
d57Yk1tqImvWx8DuF2sL)`)AP+P22XL{sR(L{Sp8G
literal 0
HcmV?d00001
diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp
index 50074f1da..f55e35a8f 100644
--- a/launcher/ui/MainWindow.cpp
+++ b/launcher/ui/MainWindow.cpp
@@ -996,6 +996,14 @@ void MainWindow::processURLs(QList 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;
}
diff --git a/launcher/ui/dialogs/MSALoginDialog.cpp b/launcher/ui/dialogs/MSALoginDialog.cpp
index a654c1d29..5f311e625 100644
--- a/launcher/ui/dialogs/MSALoginDialog.cpp
+++ b/launcher/ui/dialogs/MSALoginDialog.cpp
@@ -34,6 +34,8 @@
*/
#include "MSALoginDialog.h"
+#include "Application.h"
+
#include "ui_MSALoginDialog.h"
#include "DesktopServices.h"
@@ -41,6 +43,7 @@
#include
#include
+#include
#include
#include
@@ -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 += "
";
}
}
- 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("%2").arg(uri, uri);
+ ui->urlInfo->setText(
tr("Browser opened to complete the login process."
"
"
- "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:
"));
+ 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("%2").arg(url, url);
+ ui->code->setText(code);
+ ui->codeInfo->setText(tr("Enter this code into %1 and choose your account.
").arg(linkString));
- ui->progressBar->setMaximum(expiresIn);
- ui->progressBar->setValue(m_external_elapsed);
+ const auto isDefaultUrl = url == "https://www.microsoft.com/link";
- QString linkString = QString("%2").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("Please login in the opened browser. If no browser was opened, please open up %1 in "
- "a browser and put in the code %2 to proceed with login.
")
- .arg(linkString, code));
- } else {
- ui->message->setText(
- tr("Please open up %1 in a browser and put in the code %2 to proceed with login.
").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;
}
\ No newline at end of file
diff --git a/launcher/ui/dialogs/MSALoginDialog.h b/launcher/ui/dialogs/MSALoginDialog.h
index cef647ee4..cf806d88b 100644
--- a/launcher/ui/dialogs/MSALoginDialog.h
+++ b/launcher/ui/dialogs/MSALoginDialog.h
@@ -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 m_task;
- int m_external_elapsed;
- int m_external_timeout;
- QTimer m_external_timer;
-
bool m_using_device_code = false;
};
diff --git a/launcher/ui/dialogs/MSALoginDialog.ui b/launcher/ui/dialogs/MSALoginDialog.ui
index df1b32044..afd97e348 100644
--- a/launcher/ui/dialogs/MSALoginDialog.ui
+++ b/launcher/ui/dialogs/MSALoginDialog.ui
@@ -6,90 +6,337 @@
0
0
- 491
- 208
+ 500
+ 300
-
-
- 0
- 0
-
-
Add Microsoft Account
-
-
-
-
- 0
- 0
-
-
-
-
- 500
- 500
-
-
-
-
-
-
- Qt::RichText
-
-
- true
-
-
- true
-
-
- Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+
+
+ 2
+
+
+
-
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+
+ 16
+ 75
+ true
+
+
+
+ Please wait...
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Status
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 40
+ 75
+ true
+
+
+
+ IBeamCursor
+
+
+ CODE
+
+
+ Qt::AlignCenter
+
+
+ Qt::TextBrowserInteraction
+
+
+
+ -
+
+
+ Copy code to clipboard
+
+
+
+
+
+
+ ..
+
+
+
+ 22
+ 22
+
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+
+ false
+
+
+
+ Information
+
+
+ Qt::AlignCenter
+
+
+ true
+
+
+ Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 100
+ 100
+
+
+
+
+
+
+ :/assets/login-qr.png
+
+
+ true
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+
+ false
+
+
+
+ Information
+
+
+ Qt::AlignCenter
+
+
+ true
+
+
+ true
+
+
+ Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse
+
+
+
+ -
+
+
+ url
+
+
+ Qt::AlignCenter
+
+
+ true
+
+
+ Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
-
-
-
-
-
-
- false
-
-
-
- -
-
-
-
-
-
-
- ..
-
-
-
-
-
- -
-
-
- 24
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Help
-
+
false
- -
-
-
- Cancel
-
-
-
diff --git a/launcher/ui/pages/global/AccountListPage.cpp b/launcher/ui/pages/global/AccountListPage.cpp
index 8d0b66004..3c77cb97a 100644
--- a/launcher/ui/pages/global/AccountListPage.cpp
+++ b/launcher/ui/pages/global/AccountListPage.cpp
@@ -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);
diff --git a/program_info/org.prismlauncher.PrismLauncher.desktop.in b/program_info/org.prismlauncher.PrismLauncher.desktop.in
index a2846b06e..7d186a2e7 100644
--- a/program_info/org.prismlauncher.PrismLauncher.desktop.in
+++ b/program_info/org.prismlauncher.PrismLauncher.desktop.in
@@ -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;
diff --git a/program_info/win_install.nsi.in b/program_info/win_install.nsi.in
index eda85821b..cc56b9bd5 100644
--- a/program_info/win_install.nsi.in
+++ b/program_info/win_install.nsi.in
@@ -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