mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Remove captcha dialog from the member list
This commit is contained in:
parent
797a69fd90
commit
0c6a3b6282
2 changed files with 33 additions and 40 deletions
|
@ -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(
|
|
||||||
captchaDialog_.get(),
|
|
||||||
&dialogs::ReCaptcha::closing,
|
|
||||||
this,
|
|
||||||
[this, user, pass, session]() {
|
|
||||||
captchaDialog_->close();
|
|
||||||
emit registering();
|
|
||||||
|
|
||||||
http::client()->flow_response(
|
connect(captchaDialog,
|
||||||
user,
|
&dialogs::ReCaptcha::closing,
|
||||||
pass,
|
this,
|
||||||
session,
|
[this, user, pass, session, captchaDialog]() {
|
||||||
"m.login.recaptcha",
|
captchaDialog->close();
|
||||||
[this](const mtx::responses::Register &res,
|
captchaDialog->deleteLater();
|
||||||
mtx::http::RequestErr err) {
|
|
||||||
if (err) {
|
|
||||||
nhlog::net()->warn(
|
|
||||||
"failed to retrieve registration flows: {}",
|
|
||||||
err->matrix_error.error);
|
|
||||||
emit errorOccurred();
|
|
||||||
emit registerErrorCb(QString::fromStdString(
|
|
||||||
err->matrix_error.error));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
http::client()->set_user(res.user_id);
|
emit registering();
|
||||||
http::client()->set_access_token(res.access_token);
|
|
||||||
|
|
||||||
emit registerOk();
|
http::client()->flow_response(
|
||||||
});
|
user,
|
||||||
});
|
pass,
|
||||||
}
|
session,
|
||||||
|
"m.login.recaptcha",
|
||||||
|
[this](const mtx::responses::Register &res,
|
||||||
|
mtx::http::RequestErr err) {
|
||||||
|
if (err) {
|
||||||
|
nhlog::net()->warn(
|
||||||
|
"failed to retrieve registration flows: {}",
|
||||||
|
err->matrix_error.error);
|
||||||
|
emit errorOccurred();
|
||||||
|
emit registerErrorCb(QString::fromStdString(
|
||||||
|
err->matrix_error.error));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QTimer::singleShot(1000, this, [this]() { captchaDialog_->show(); });
|
http::client()->set_user(res.user_id);
|
||||||
|
http::client()->set_access_token(res.access_token);
|
||||||
|
|
||||||
|
emit registerOk();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
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…
Reference in a new issue