diff options
author | Felix Weilbach <felix.weilbach@nextcloud.com> | 2021-08-30 14:25:53 +0300 |
---|---|---|
committer | Matthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr> | 2021-09-03 11:32:15 +0300 |
commit | ba2d8e8201d21e421ff7a307caf43b596fd7e6fb (patch) | |
tree | 2343a6b6421f1fe96b72dce32ee9c797eefb970b /src/gui/wizard | |
parent | 9e6e4095a80542a4a4df4389b21e32156509f937 (diff) |
Only set dav user after login.
Setting the credentials of the account inside the auth widget is not a
good idea as that will destroy the previous credentials object which
may wait for a signal to be emitted by the credentials dialog that
was created by the credentials that are going to be deleted. Uff.
It should be enough to set the dav user only after login because the
dav user will never change.
See also the discussion here
https://github.com/nextcloud/desktop/issues/3677#issuecomment-907976839
Fixes #3677
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
Diffstat (limited to 'src/gui/wizard')
-rw-r--r-- | src/gui/wizard/flow2authwidget.cpp | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/src/gui/wizard/flow2authwidget.cpp b/src/gui/wizard/flow2authwidget.cpp index 98b6b74ed..87f63d591 100644 --- a/src/gui/wizard/flow2authwidget.cpp +++ b/src/gui/wizard/flow2authwidget.cpp @@ -108,27 +108,7 @@ void Flow2AuthWidget::slotAuthResult(Flow2Auth::Result r, const QString &errorSt } } - _account->setCredentials(new WebFlowCredentials(user, appPassword)); - const auto fetchUserNameJob = new JsonApiJob(_account->sharedFromThis(), QStringLiteral("/ocs/v1.php/cloud/user")); - connect(fetchUserNameJob, &JsonApiJob::jsonReceived, this, [this, fetchUserNameJob, r, errorString, user, appPassword](const QJsonDocument &json, int statusCode) { - fetchUserNameJob->deleteLater(); - if (statusCode != 100) { - qCWarning(lcFlow2AuthWidget) << "Could not fetch username."; - _account->setDavUser(""); - _account->setDavDisplayName(user); - emit authResult(r, errorString, user, appPassword); - return; - } - - const auto objData = json.object().value("ocs").toObject().value("data").toObject(); - const auto userId = objData.value("id").toString(user); - const auto displayName = objData.value("display-name").toString(); - _account->setDavUser(userId); - _account->setDavDisplayName(displayName); - - emit authResult(r, errorString, user, appPassword); - }); - fetchUserNameJob->start(); + emit authResult(r, errorString, user, appPassword); } void Flow2AuthWidget::setError(const QString &error) { |