From 8897f16d1dd2d0736d9d50a99f8395c1eb1f2ac0 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Tue, 7 Nov 2023 10:52:52 +0200 Subject: [PATCH] simplify microsoft login Signed-off-by: Trial97 --- launcher/ui/dialogs/MSALoginDialog.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/launcher/ui/dialogs/MSALoginDialog.cpp b/launcher/ui/dialogs/MSALoginDialog.cpp index 74fff9fd3..5dba84858 100644 --- a/launcher/ui/dialogs/MSALoginDialog.cpp +++ b/launcher/ui/dialogs/MSALoginDialog.cpp @@ -105,8 +105,17 @@ void MSALoginDialog::showVerificationUriAndCode(const QUrl& uri, const QString& QString urlString = uri.toString(); QString linkString = QString("%2").arg(urlString, urlString); - ui->label->setText( - tr("

Please open up %1 in a browser and put in the code %2 to proceed with login.

").arg(linkString, code)); + if (urlString == "https://www.microsoft.com/link" && !code.isEmpty()) { + urlString += QString("?otc=%1").arg(code); + DesktopServices::openUrl(urlString); + ui->label->setText( + tr("

Please login in the opened browser. If no browser was opened please follow the following instructions:

" + "

Please open up %1 in a browser and put in the code %2 to proceed with login.

") + .arg(linkString, code)); + } else { + ui->label->setText( + tr("

Please open up %1 in a browser and put in the code %2 to proceed with login.

").arg(linkString, code)); + } ui->actionButton->setVisible(true); connect(ui->actionButton, &QPushButton::clicked, [=]() { DesktopServices::openUrl(uri);