summary refs log tree commit diff
path: root/src/ReCaptcha.cpp
diff options
context:
space:
mode:
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);
+}