Remove captcha dialog from the member list

This commit is contained in:
Konstantinos Sideris 2018-09-05 18:05:27 +03:00
parent 797a69fd90
commit 0c6a3b6282
2 changed files with 33 additions and 40 deletions

View file

@ -134,15 +134,16 @@ 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]() { [this, user, pass, session, captchaDialog]() {
captchaDialog_->close(); captchaDialog->close();
captchaDialog->deleteLater();
emit registering(); emit registering();
http::client()->flow_response( http::client()->flow_response(
@ -168,9 +169,8 @@ RegisterPage::RegisterPage(QWidget *parent)
emit registerOk(); emit registerOk();
}); });
}); });
}
QTimer::singleShot(1000, this, [this]() { captchaDialog_->show(); }); QTimer::singleShot(1000, this, [captchaDialog]() { captchaDialog->show(); });
}); });
setLayout(top_layout_); setLayout(top_layout_);

View file

@ -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_;
}; };