matrixion/src/ReCaptcha.cpp

32 lines
778 B
C++
Raw Normal View History

2023-06-29 00:00:34 +03:00
// 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)
2023-06-29 19:58:34 +03:00
: QObject{parent}
, m_session{session}
, m_context{context}
2023-06-29 00:00:34 +03:00
{
}
2023-06-29 19:58:34 +03:00
void
ReCaptcha::openReCaptcha()
2023-06-29 00:00:34 +03:00
{
const auto url = QStringLiteral("https://%1:%2/_matrix/client/r0/auth/m.login.recaptcha/"
"fallback/web?session=%3")
2023-06-29 00:00:34 +03:00
.arg(QString::fromStdString(http::client()->server()))
.arg(http::client()->port())
.arg(m_session);
QDesktopServices::openUrl(url);
}
#include "moc_ReCaptcha.cpp"