Remove captcha dialog from the member list

remotes/origin/HEAD
Konstantinos Sideris 7 years ago
parent 797a69fd90
commit 0c6a3b6282
  1. 74
      src/RegisterPage.cpp
  2. 7
      src/RegisterPage.h

@ -134,43 +134,43 @@ RegisterPage::RegisterPage(QWidget *parent)
[this](const std::string &user, const std::string &pass, const std::string &session) { [this](const std::string &user, const std::string &pass, const std::string &session) {
emit errorOccurred(); emit errorOccurred();
if (!captchaDialog_) { auto captchaDialog =
captchaDialog_ = std::make_shared<dialogs::ReCaptcha>( new dialogs::ReCaptcha(QString::fromStdString(session), this);
QString::fromStdString(session), this);
connect( connect(captchaDialog,
captchaDialog_.get(), &dialogs::ReCaptcha::closing,
&dialogs::ReCaptcha::closing, this,
this, [this, user, pass, session, captchaDialog]() {
[this, user, pass, session]() { captchaDialog->close();
captchaDialog_->close(); captchaDialog->deleteLater();
emit registering();
emit registering();
http::client()->flow_response(
user, http::client()->flow_response(
pass, user,
session, pass,
"m.login.recaptcha", session,
[this](const mtx::responses::Register &res, "m.login.recaptcha",
mtx::http::RequestErr err) { [this](const mtx::responses::Register &res,
if (err) { mtx::http::RequestErr err) {
nhlog::net()->warn( if (err) {
"failed to retrieve registration flows: {}", nhlog::net()->warn(
err->matrix_error.error); "failed to retrieve registration flows: {}",
emit errorOccurred(); err->matrix_error.error);
emit registerErrorCb(QString::fromStdString( emit errorOccurred();
err->matrix_error.error)); emit registerErrorCb(QString::fromStdString(
return; err->matrix_error.error));
} return;
}
http::client()->set_user(res.user_id);
http::client()->set_access_token(res.access_token); http::client()->set_user(res.user_id);
http::client()->set_access_token(res.access_token);
emit registerOk();
}); emit registerOk();
}); });
} });
QTimer::singleShot(1000, this, [this]() { captchaDialog_->show(); }); QTimer::singleShot(1000, this, [captchaDialog]() { captchaDialog->show(); });
}); });
setLayout(top_layout_); setLayout(top_layout_);

@ -25,10 +25,6 @@ class FlatButton;
class RaisedButton; class RaisedButton;
class TextField; class TextField;
namespace dialogs {
class ReCaptcha;
}
class RegisterPage : public QWidget class RegisterPage : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -77,7 +73,4 @@ private:
TextField *password_input_; TextField *password_input_;
TextField *password_confirmation_; TextField *password_confirmation_;
TextField *server_input_; TextField *server_input_;
//! ReCaptcha dialog.
std::shared_ptr<dialogs::ReCaptcha> captchaDialog_;
}; };

Loading…
Cancel
Save