From 95046c4b5d4e41d4c25b41296e8da3a12efcb1b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey=20Vilas?= Date: Wed, 23 Mar 2022 18:22:11 +0100 Subject: [PATCH] AccountRemovalWork: remove cached owncloudClient after removing account MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise, the account (which is identified by account name only) will reuse old token, if login is done right after account removal. Three hours of debugging for one line of code Signed-off-by: Álvaro Brey Vilas --- .../main/java/com/nextcloud/client/jobs/AccountRemovalWork.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nextcloud/client/jobs/AccountRemovalWork.kt b/app/src/main/java/com/nextcloud/client/jobs/AccountRemovalWork.kt index 4aeb70ba26..0f8182592e 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/AccountRemovalWork.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/AccountRemovalWork.kt @@ -58,7 +58,6 @@ import com.owncloud.android.utils.FileStorageUtils import com.owncloud.android.utils.PushUtils import org.greenrobot.eventbus.EventBus import java.io.File -import java.util.ArrayList /** * Removes account and all local files @@ -150,6 +149,9 @@ class AccountRemovalWork( deleteAppPasswordRemoteOperation.execute(optionNextcloudClient.get()) } + // delete cached OwncloudClient + OwnCloudClientManagerFactory.getDefaultSingleton().removeClientFor(user.toOwnCloudAccount()) + if (userRemoved) { eventBus.post(AccountRemovedEvent()) }