Skip to content
Snippets Groups Projects
ReCaptcha.cpp 734 B
Newer Older
  • Learn to ignore specific revisions
  • // 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)
    
    Loren Burkholder's avatar
    Loren Burkholder committed
      : QObject{parent}
      , m_session{session}
      , m_context{context}
    
    Loren Burkholder's avatar
    Loren Burkholder committed
    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);
    }