summary refs log tree commit diff
path: root/src/ReCaptcha.cpp
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2023-06-28 17:00:34 -0400
committerLoren Burkholder <computersemiexpert@outlook.com>2023-07-06 08:35:37 -0400
commitfedc178827c5648b0ccbdd2cd08dcebc920ac416 (patch)
tree7c6c59b60899d8c7a321bea8fe44c7d04f79040f /src/ReCaptcha.cpp
parentRemove unneeded forward declaration (diff)
downloadnheko-fedc178827c5648b0ccbdd2cd08dcebc920ac416.tar.xz
Port the reCAPTCHA dialog to QML
Diffstat (limited to 'src/ReCaptcha.cpp')
-rw-r--r--src/ReCaptcha.cpp28
1 files changed, 28 insertions, 0 deletions
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 <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); +}