diff options
Diffstat (limited to 'src/FallbackAuth.cpp')
-rw-r--r-- | src/FallbackAuth.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/FallbackAuth.cpp b/src/FallbackAuth.cpp new file mode 100644 index 00000000..5b668310 --- /dev/null +++ b/src/FallbackAuth.cpp @@ -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); +} |