Skip to content
Snippets Groups Projects
Verified Commit 2e7d26bc authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Fix secrets not loading after registration

parent 6a3d55b4
No related branches found
No related tags found
No related merge requests found
Pipeline #2538 failed
...@@ -391,6 +391,7 @@ Cache::loadSecrets(std::vector<std::pair<std::string, bool>> toLoad) ...@@ -391,6 +391,7 @@ Cache::loadSecrets(std::vector<std::pair<std::string, bool>> toLoad)
&QKeychain::ReadPasswordJob::finished, &QKeychain::ReadPasswordJob::finished,
this, this,
[this, name, toLoad, job](QKeychain::Job *) mutable { [this, name, toLoad, job](QKeychain::Job *) mutable {
nhlog::db()->debug("Finished reading '{}'", toLoad.begin()->first);
const QString secret = job->textData(); const QString secret = job->textData();
if (job->error() && job->error() != QKeychain::Error::EntryNotFound) { if (job->error() && job->error() != QKeychain::Error::EntryNotFound) {
nhlog::db()->error("Restoring secret '{}' failed ({}): {}", nhlog::db()->error("Restoring secret '{}' failed ({}): {}",
...@@ -413,6 +414,7 @@ Cache::loadSecrets(std::vector<std::pair<std::string, bool>> toLoad) ...@@ -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. // You can't start a job from the finish signal of a job.
QTimer::singleShot(0, this, [this, toLoad] { loadSecrets(toLoad); }); QTimer::singleShot(0, this, [this, toLoad] { loadSecrets(toLoad); });
}); });
nhlog::db()->debug("Reading '{}'", name_);
job->start(); job->start();
} }
......
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
RegisterPage::RegisterPage(QObject *parent) RegisterPage::RegisterPage(QObject *parent)
: QObject(parent) : QObject(parent)
{} {
connect(this, &RegisterPage::registerOk, this, [] { MainWindow::instance()->showChatPage(); });
}
void void
RegisterPage::setError(QString err) RegisterPage::setError(QString err)
...@@ -199,7 +201,7 @@ RegisterPage::startRegistration(QString username, QString password, QString devi ...@@ -199,7 +201,7 @@ RegisterPage::startRegistration(QString username, QString password, QString devi
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);
MainWindow::instance()->showChatPage(); emit registerOk();
disconnect(UIA::instance(), &UIA::error, this, nullptr); disconnect(UIA::instance(), &UIA::error, this, nullptr);
return; return;
} }
......
...@@ -53,6 +53,8 @@ signals: ...@@ -53,6 +53,8 @@ signals:
void lookingUpHsChanged(); void lookingUpHsChanged();
void lookingUpUsernameChanged(); void lookingUpUsernameChanged();
void registerOk();
private: private:
void versionsCheck(); void versionsCheck();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment