summary refs log tree commit diff
path: root/src/ReCaptcha.cpp
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2023-07-06 18:53:03 +0000
committerGitHub <noreply@github.com>2023-07-06 18:53:03 +0000
commit8112922c5f167f68a12c7989bd2aef75d2eb18b5 (patch)
tree3d61ed11aa2229e5d67a69886c7950ee7088a180 /src/ReCaptcha.cpp
parentAdd an early out cache for event expiration (diff)
parentRemove duplicate UIA error display (diff)
downloadnheko-8112922c5f167f68a12c7989bd2aef75d2eb18b5.tar.xz
Merge pull request #1501 from Nheko-Reborn/qmlRecaptcha
QML the reCAPTCHA dialog
Diffstat (limited to 'src/ReCaptcha.cpp')
-rw-r--r--src/ReCaptcha.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/ReCaptcha.cpp b/src/ReCaptcha.cpp
new file mode 100644

index 00000000..ab9db8cc --- /dev/null +++ b/src/ReCaptcha.cpp
@@ -0,0 +1,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); +}