Fix secrets not loading after registration

This commit is contained in:
Nicolas Werner 2022-01-29 17:27:28 +01:00
parent 6a3d55b47f
commit 2e7d26bcc0
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
3 changed files with 8 additions and 2 deletions

View File

@ -391,6 +391,7 @@ Cache::loadSecrets(std::vector<std::pair<std::string, bool>> toLoad)
&QKeychain::ReadPasswordJob::finished,
this,
[this, name, toLoad, job](QKeychain::Job *) mutable {
nhlog::db()->debug("Finished reading '{}'", toLoad.begin()->first);
const QString secret = job->textData();
if (job->error() && job->error() != QKeychain::Error::EntryNotFound) {
nhlog::db()->error("Restoring secret '{}' failed ({}): {}",
@ -413,6 +414,7 @@ Cache::loadSecrets(std::vector<std::pair<std::string, bool>> toLoad)
// You can't start a job from the finish signal of a job.
QTimer::singleShot(0, this, [this, toLoad] { loadSecrets(toLoad); });
});
nhlog::db()->debug("Reading '{}'", name_);
job->start();
}

View File

@ -19,7 +19,9 @@
RegisterPage::RegisterPage(QObject *parent)
: QObject(parent)
{}
{
connect(this, &RegisterPage::registerOk, this, [] { MainWindow::instance()->showChatPage(); });
}
void
RegisterPage::setError(QString err)
@ -199,7 +201,7 @@ RegisterPage::startRegistration(QString username, QString password, QString devi
if (!err) {
http::client()->set_user(res.user_id);
http::client()->set_access_token(res.access_token);
MainWindow::instance()->showChatPage();
emit registerOk();
disconnect(UIA::instance(), &UIA::error, this, nullptr);
return;
}

View File

@ -53,6 +53,8 @@ signals:
void lookingUpHsChanged();
void lookingUpUsernameChanged();
void registerOk();
private:
void versionsCheck();