Skip to content

Commit

Permalink
add otc query parameter to login link
Browse files Browse the repository at this point in the history
  • Loading branch information
kaduvert committed Dec 31, 2023
1 parent 7450faa commit fca7ee6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions launcher/ui/dialogs/MSALoginDialog.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2013-2022 MultiMC Contributors
/* Copyright 2013-2023 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,6 +20,7 @@

#include <QtWidgets/QPushButton>
#include <QUrl>
#include <QUrlQuery>
#include <QClipboard>

MSALoginDialog::MSALoginDialog(QWidget *parent) : QDialog(parent), ui(new Ui::MSALoginDialog)
Expand Down Expand Up @@ -82,9 +83,13 @@ void MSALoginDialog::showVerificationUriAndCode(const QUrl& uri, const QString&
ui->progressBar->setMaximum(expiresIn);
ui->progressBar->setValue(m_externalLoginElapsed);

QString urlString = uri.toString();
QUrl url = QUrl(uri);
QUrlQuery otcQuery = QUrlQuery(url);
otcQuery.addQueryItem(QString("otc"), code);

QString urlString = url.toString();
QString linkString = QString("<a href=\"%1\">%2</a>").arg(urlString, urlString);
ui->label->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->label->setText(tr("<p>Please open up %1 in a browser to proceed with login.</p>").arg(linkString));

m_code = code;
}
Expand Down

0 comments on commit fca7ee6

Please sign in to comment.