mirror of
https://github.com/nextcloud/android.git
synced 2024-11-25 14:45:47 +03:00
AuthenticatorAsyncTask: check if user info result is success before proceeding
This will not fix failed logins but at least it will not crash the app. Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
556b3b4b79
commit
29d9ba4e52
1 changed files with 15 additions and 11 deletions
|
@ -76,20 +76,24 @@ public class AuthenticatorAsyncTask extends AsyncTask<Object, Void, RemoteOperat
|
|||
RemoteOperationResult<UserInfo> userInfoResult = new GetUserInfoRemoteOperation().execute(nextcloudClient);
|
||||
|
||||
// Operation - try credentials
|
||||
OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, context, true);
|
||||
client.setUserId(userInfoResult.getResultData().getId());
|
||||
client.setCredentials(credentials);
|
||||
if (userInfoResult.isSuccess()) {
|
||||
OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, context, true);
|
||||
client.setUserId(userInfoResult.getResultData().getId());
|
||||
client.setCredentials(credentials);
|
||||
|
||||
ExistenceCheckRemoteOperation operation = new ExistenceCheckRemoteOperation(ROOT_PATH, SUCCESS_IF_ABSENT);
|
||||
result = operation.execute(client);
|
||||
ExistenceCheckRemoteOperation operation = new ExistenceCheckRemoteOperation(ROOT_PATH, SUCCESS_IF_ABSENT);
|
||||
result = operation.execute(client);
|
||||
|
||||
if (operation.wasRedirected()) {
|
||||
RedirectionPath redirectionPath = operation.getRedirectionPath();
|
||||
String permanentLocation = redirectionPath.getLastPermanentLocation();
|
||||
result.setLastPermanentLocation(permanentLocation);
|
||||
if (operation.wasRedirected()) {
|
||||
RedirectionPath redirectionPath = operation.getRedirectionPath();
|
||||
String permanentLocation = redirectionPath.getLastPermanentLocation();
|
||||
result.setLastPermanentLocation(permanentLocation);
|
||||
}
|
||||
|
||||
result.setResultData(userInfoResult.getResultData());
|
||||
} else {
|
||||
result = userInfoResult;
|
||||
}
|
||||
|
||||
result.setResultData(userInfoResult.getResultData());
|
||||
} else {
|
||||
result = new RemoteOperationResult(RemoteOperationResult.ResultCode.UNKNOWN_ERROR);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue