| 1 | // SPDX-FileCopyrightText: Nheko Contributors |
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #include "ReCaptcha.h" |
| 6 | |
| 7 | #include <QDesktopServices> |
| 8 | #include <QUrl> |
| 9 | |
| 10 | #include "MatrixClient.h" |
| 11 | |
| 12 | ReCaptcha::ReCaptcha(const QString &session, const QString &context, QObject *parent) |
| 13 | : QObject{parent} |
| 14 | , m_session{session} |
| 15 | , m_context{context} |
| 16 | { |
| 17 | } |
| 18 | |
| 19 | void |
| 20 | ReCaptcha::openReCaptcha() |
| 21 | { |
| 22 | const auto url = QStringLiteral("https://%1:%2/_matrix/client/r0/auth/m.login.recaptcha/" |
| 23 | "fallback/web?session=%3") |
| 24 | .arg(QString::fromStdString(http::client()->server())) |
| 25 | .arg(http::client()->port()) |
| 26 | .arg(m_session); |
| 27 | |
| 28 | QDesktopServices::openUrl(url); |
| 29 | } |
| 30 | |
| 31 | #include "moc_ReCaptcha.cpp" |