Merge pull request #186 from owncloud/fixed_contradicted_messages_in_login_view
authorDavid A. Velasco <dvelasco@owncloud.com>
Wed, 19 Jun 2013 15:02:50 +0000 (08:02 -0700)
committerDavid A. Velasco <dvelasco@owncloud.com>
Wed, 19 Jun 2013 15:02:50 +0000 (08:02 -0700)
Fixed contradicted messages in login view

src/com/owncloud/android/authentication/AuthenticatorActivity.java
src/com/owncloud/android/operations/RemoteOperationResult.java

index e483970..3c34be6 100644 (file)
@@ -935,7 +935,33 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
 \r
             finish();\r
 \r
-        } else {\r
+        } else if (result.isServerFail() || result.isException()) {\r
+            /// if server fail or exception in authorization, the UI is updated as when a server check failed\r
+            mServerIsChecked = true;\r
+            mServerIsValid = false;\r
+            mIsSslConn = false;\r
+            mOcServerChkOperation = null;\r
+            mDiscoveredVersion = null;\r
+            mHostBaseUrl = normalizeUrl(mHostUrlInput.getText().toString());\r
+\r
+            // update status icon and text\r
+            updateServerStatusIconAndText(result);\r
+            showServerStatus();\r
+            mAuthStatusIcon = 0;\r
+            mAuthStatusText = 0;\r
+            showAuthStatus();\r
+            \r
+            // update input controls state\r
+            showRefreshButton();\r
+            mOkButton.setEnabled(false);\r
+\r
+            // very special case (TODO: move to a common place for all the remote operations) (dangerous here?)\r
+            if (result.getCode() == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED) {\r
+                mLastSslUntrustedServerResult = result;\r
+                showDialog(DIALOG_SSL_VALIDATOR); \r
+            }\r
+\r
+        } else {    // authorization fail due to client side - probably wrong credentials\r
             updateAuthStatusIconAndText(result);\r
             showAuthStatus();\r
             Log_OC.d(TAG, "Access failed: " + result.getLogMessage());\r
index 16b4779..059c290 100644 (file)
@@ -267,4 +267,12 @@ public class RemoteOperationResult implements Serializable {
 
     }
 
+    public boolean isServerFail() {
+        return (mHttpCode >= HttpStatus.SC_INTERNAL_SERVER_ERROR);
+    }
+
+    public boolean isException() {
+        return (mException != null);
+    }
+
 }