Sfoglia il codice sorgente

AccountRemovalWork: remove cached owncloudClient after removing account

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 <alvaro.brey@nextcloud.com>
Álvaro Brey Vilas 3 anni fa
parent
commit
95046c4b5d

+ 3 - 1
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())
         }