summary refs log tree commit diff
path: root/src/ReCaptcha.cpp
blob: ab9db8cc51f083f78d4279f96556eb2a98518576 (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 "ReCaptcha.h"

#include <QDesktopServices>
#include <QUrl>

#include "MatrixClient.h"

ReCaptcha::ReCaptcha(const QString &session, const QString &context, QObject *parent)
  : QObject{parent}
  , m_session{session}
  , m_context{context}
{
}

void
ReCaptcha::openReCaptcha()
{
    const auto url = QString("https://%1:%2/_matrix/client/r0/auth/m.login.recaptcha/"
                             "fallback/web?session=%3")
                       .arg(QString::fromStdString(http::client()->server()))
                       .arg(http::client()->port())
                       .arg(m_session);

    QDesktopServices::openUrl(url);
}