change mtxclient url, fix login page assert failure and dendrite registration bug

This commit is contained in:
Jedi18 2021-02-25 18:10:06 +05:30
parent 043737c8cb
commit 4a5b9d014a
5 changed files with 13 additions and 6 deletions

View file

@ -358,7 +358,7 @@ if(USE_BUNDLED_MTXCLIENT)
FetchContent_Declare( FetchContent_Declare(
MatrixClient MatrixClient
GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
GIT_TAG fee5298f068394958c2de935836a2c145f273906 GIT_TAG 004d4203ceb441239aafb17e1340cd063139d029
) )
set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "") set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "")
set(BUILD_LIB_TESTS OFF CACHE INTERNAL "") set(BUILD_LIB_TESTS OFF CACHE INTERNAL "")

View file

@ -220,7 +220,7 @@
"name": "mtxclient", "name": "mtxclient",
"sources": [ "sources": [
{ {
"commit": "fee5298f068394958c2de935836a2c145f273906", "commit": "004d4203ceb441239aafb17e1340cd063139d029",
"type": "git", "type": "git",
"url": "https://github.com/Nheko-Reborn/mtxclient.git" "url": "https://github.com/Nheko-Reborn/mtxclient.git"
} }

View file

@ -192,6 +192,11 @@ LoginPage::LoginPage(QWidget *parent)
connect(sso_login_button_, &RaisedButton::clicked, this, [this]() { connect(sso_login_button_, &RaisedButton::clicked, this, [this]() {
onLoginButtonClicked(LoginMethod::SSO); onLoginButtonClicked(LoginMethod::SSO);
}); });
connect(this,
&LoginPage::showErrorMessage,
this,
static_cast<void (LoginPage::*)(QLabel *, const QString &)>(&LoginPage::showError),
Qt::QueuedConnection);
connect(matrixid_input_, SIGNAL(returnPressed()), login_button_, SLOT(click())); connect(matrixid_input_, SIGNAL(returnPressed()), login_button_, SLOT(click()));
connect(password_input_, SIGNAL(returnPressed()), login_button_, SLOT(click())); connect(password_input_, SIGNAL(returnPressed()), login_button_, SLOT(click()));
connect(deviceName_, SIGNAL(returnPressed()), login_button_, SLOT(click())); connect(deviceName_, SIGNAL(returnPressed()), login_button_, SLOT(click()));
@ -422,8 +427,8 @@ LoginPage::onLoginButtonClicked(LoginMethod loginMethod)
: deviceName_->text().toStdString(), : deviceName_->text().toStdString(),
[this](const mtx::responses::Login &res, mtx::http::RequestErr err) { [this](const mtx::responses::Login &res, mtx::http::RequestErr err) {
if (err) { if (err) {
showError(error_label_, showErrorMessage(error_label_,
QString::fromStdString(err->matrix_error.error)); QString::fromStdString(err->matrix_error.error));
emit errorOccurred(); emit errorOccurred();
return; return;
} }
@ -448,7 +453,7 @@ LoginPage::onLoginButtonClicked(LoginMethod loginMethod)
http::client()->login( http::client()->login(
req, [this](const mtx::responses::Login &res, mtx::http::RequestErr err) { req, [this](const mtx::responses::Login &res, mtx::http::RequestErr err) {
if (err) { if (err) {
showError( showErrorMessage(
error_label_, error_label_,
QString::fromStdString(err->matrix_error.error)); QString::fromStdString(err->matrix_error.error));
emit errorOccurred(); emit errorOccurred();
@ -467,7 +472,7 @@ LoginPage::onLoginButtonClicked(LoginMethod loginMethod)
sso->deleteLater(); sso->deleteLater();
}); });
connect(sso, &SSOHandler::ssoFailed, this, [this, sso]() { connect(sso, &SSOHandler::ssoFailed, this, [this, sso]() {
showError(error_label_, tr("SSO login failed")); showErrorMessage(error_label_, tr("SSO login failed"));
emit errorOccurred(); emit errorOccurred();
sso->deleteLater(); sso->deleteLater();
}); });

View file

@ -59,6 +59,7 @@ signals:
void versionOkCb(bool passwordSupported, bool ssoSupported); void versionOkCb(bool passwordSupported, bool ssoSupported);
void loginOk(const mtx::responses::Login &res); void loginOk(const mtx::responses::Login &res);
void showErrorMessage(QLabel *label, const QString &msg);
protected: protected:
void paintEvent(QPaintEvent *event) override; void paintEvent(QPaintEvent *event) override;

View file

@ -277,6 +277,7 @@ RegisterPage::RegisterPage(QWidget *parent)
if (!err) { if (!err) {
http::client()->set_user(res.user_id); http::client()->set_user(res.user_id);
http::client()->set_access_token(res.access_token); http::client()->set_access_token(res.access_token);
http::client()->set_device_id(res.device_id);
emit registerOk(); emit registerOk();
return; return;