Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/android-library.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÁlvaro Brey <alvaro.brey@nextcloud.com>2021-11-09 15:56:27 +0300
committerGitHub <noreply@github.com>2021-11-09 15:56:27 +0300
commitda770c2c37a0259f3e36f378a444acf3eab676de (patch)
tree3ed281b7d2f3c0bf762d4940bc0e2f299f0e8d56
parentd79116ef099e28e12a17a87dc8d1d992352c3e34 (diff)
parent8f5f2600db62b34afaa4ea6d987910ec2701e78c (diff)
Merge pull request #751 from nextcloud/backport/638rc-2.8.0-03
[stable-2.8] Fix for failed logins / app crashes
-rw-r--r--src/main/java/com/owncloud/android/lib/common/OwnCloudClientFactory.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/main/java/com/owncloud/android/lib/common/OwnCloudClientFactory.java b/src/main/java/com/owncloud/android/lib/common/OwnCloudClientFactory.java
index 62e4ec69..9a883b96 100644
--- a/src/main/java/com/owncloud/android/lib/common/OwnCloudClientFactory.java
+++ b/src/main/java/com/owncloud/android/lib/common/OwnCloudClientFactory.java
@@ -35,12 +35,12 @@ import android.net.Uri;
import android.os.Bundle;
import com.nextcloud.common.NextcloudClient;
+import com.nextcloud.common.OkHttpCredentialsUtil;
import com.owncloud.android.lib.common.accounts.AccountTypeUtils;
import com.owncloud.android.lib.common.accounts.AccountUtils;
import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException;
import com.owncloud.android.lib.common.network.NetworkUtils;
import com.owncloud.android.lib.common.utils.Log_OC;
-import com.nextcloud.common.OkHttpCredentialsUtil;
import java.io.IOException;
import java.security.GeneralSecurityException;
@@ -206,9 +206,19 @@ public class OwnCloudClientFactory {
// TODO avoid calling to getUserData here
String userId = am.getUserData(account, AccountUtils.Constants.KEY_USER_ID);
String username = AccountUtils.getUsernameForAccount(account);
- String password = am.peekAuthToken(account, AccountTypeUtils.getAuthTokenTypePass(account.type));
+ String password;
+ try {
+ password = am.blockingGetAuthToken(account, AccountTypeUtils.getAuthTokenTypePass(account.type), false);
+ if (password == null) {
+ Log_OC.e(TAG, "Error receiving password token (password==null)");
+ throw new AccountNotFoundException(account, "Error receiving password token (password==null)", null);
+ }
+ } catch (Exception e) {
+ Log_OC.e(TAG, "Error receiving password token", e);
+ throw new AccountNotFoundException(account, "Error receiving password token", e);
+ }
- if (username == null || username.isEmpty() || password == null || password.isEmpty()) {
+ if (username == null || username.isEmpty() || password.isEmpty()) {
throw new AccountNotFoundException(
account,
"Username or password could not be retrieved",