X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/705bee08fa4e77f399049afc1e2ffe81ce481d6f..bef5d5c5f8ed2851116b83f58bb7373ad8264d05:/src/com/owncloud/android/authentication/AuthenticatorActivity.java diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 16ce7558..a8293c34 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -176,7 +176,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity public static String DIALOG_UNTRUSTED_CERT = "DIALOG_UNTRUSTED_CERT"; - private boolean mTryEmptyAuthorization = false; + private boolean mDetectAuthorizationMethod = false; /** @@ -897,17 +897,20 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity mDiscoveredVersion = operation.getDiscoveredVersion(); mHostBaseUrl = normalizeUrl(mHostUrlInput.getText().toString()); + // Refresh server status, but don't show it + updateServerStatusIconAndText(result); + /// update status icon and text if (mServerIsValid) { hideRefreshButton(); // Try to create an account with user and pass "", to know if it is a regular server // Update connect button in the answer of this method - tryEmptyAuthorization(); + detectAuthorizationMethod(); } else { showRefreshButton(); + // Show server status + showServerStatus(); } - updateServerStatusIconAndText(result); - showServerStatus(); /// very special case (TODO: move to a common place for all the remote operations) if (result.getCode() == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED) { @@ -923,8 +926,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity /** * Try to access with user/pass ""/"", to know if it is a regular server */ - private void tryEmptyAuthorization() { - mTryEmptyAuthorization = true; + private void detectAuthorizationMethod() { + mDetectAuthorizationMethod = true; Log_OC.d(TAG, "Trying empty authorization to detect authentication method"); @@ -1140,13 +1143,13 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity private void updateStatusIconFailUserName(){ - mAuthStatusIcon = android.R.drawable.ic_secure; + mAuthStatusIcon = R.drawable.common_error; mAuthStatusText = R.string.auth_fail_get_user_name; } private void updateServerStatusIconNoRegularAuth(){ - mServerStatusIcon = android.R.drawable.ic_secure; - mServerStatusText = R.string.auth_unsupported_auth_method; + mServerStatusIcon = R.drawable.common_error; + mServerStatusText = R.string.auth_can_not_auth_against_server; } /** @@ -1200,13 +1203,12 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity } if (result.isSuccess()) { - - if (mTryEmptyAuthorization) { - //allow or not the user try to access the server + //allow or not the user try to access the server + if (mDetectAuthorizationMethod) { mOkButton.setEnabled(false); - mTryEmptyAuthorization = false; + mDetectAuthorizationMethod = false; mServerIsValid = false; - //show an alert message + //show an alert message ( Server Status ) updateServerStatusIconNoRegularAuth(); showServerStatus(); @@ -1228,10 +1230,14 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity } } else { - if (mTryEmptyAuthorization) { - mTryEmptyAuthorization = false; + if (mDetectAuthorizationMethod && + ( result.getCode() == ResultCode.UNAUTHORIZED && result.isBasicAuthentication())) { + mDetectAuthorizationMethod = false; mOkButton.setEnabled(true); - + + // Show server status + showServerStatus(); + } else if (result.isServerFail() || result.isException()) { /// if server fail or exception in authorization, the UI is updated as when a server check failed mServerIsChecked = true;