QML the fallback auth dialog

This commit is contained in:
Loren Burkholder 2023-07-13 12:53:51 -04:00
parent 03fe9f8a25
commit 0634d3f09c
9 changed files with 149 additions and 124 deletions

29
src/FallbackAuth.cpp Normal file
View file

@ -0,0 +1,29 @@
// SPDX-FileCopyrightText: Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include "FallbackAuth.h"
#include <QDesktopServices>
#include <QUrl>
#include "MatrixClient.h"
FallbackAuth::FallbackAuth(const QString &session, const QString &authType, QObject *parent)
: QObject{parent}
, m_session{session}
, m_authType{authType}
{
}
void
FallbackAuth::openFallbackAuth()
{
const auto url = QString("https://%1:%2/_matrix/client/r0/auth/%4/"
"fallback/web?session=%3")
.arg(QString::fromStdString(http::client()->server()))
.arg(http::client()->port())
.arg(m_session, m_authType);
QDesktopServices::openUrl(url);
}