summary refs log tree commit diff
path: root/src/FallbackAuth.cpp
blob: 5b6683104d1b68f32e1da92d947f6b99c0ef9367 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);
}