From fedc178827c5648b0ccbdd2cd08dcebc920ac416 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Wed, 28 Jun 2023 17:00:34 -0400 Subject: Port the reCAPTCHA dialog to QML --- src/ReCaptcha.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/ReCaptcha.cpp (limited to 'src/ReCaptcha.cpp') diff --git a/src/ReCaptcha.cpp b/src/ReCaptcha.cpp new file mode 100644 index 00000000..ffd202f5 --- /dev/null +++ b/src/ReCaptcha.cpp @@ -0,0 +1,28 @@ +// SPDX-FileCopyrightText: Nheko Contributors +// +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "ReCaptcha.h" + +#include +#include + +#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); +} -- cgit 1.5.1