From: jabarros Date: Thu, 28 Aug 2014 14:03:03 +0000 (+0200) Subject: Show alert message when user or password in authentication is not correct X-Git-Tag: oc-android-1.7.0_signed~193^2~4 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/622523b3e3ed1d5f5f9030c4323dedb28d582d16?hp=--cc Show alert message when user or password in authentication is not correct --- 622523b3e3ed1d5f5f9030c4323dedb28d582d16 diff --git a/res/values/strings.xml b/res/values/strings.xml index 2ea576ad..2be944da 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -287,5 +287,6 @@ Secure connection is redirected through an unsecured route. Authentication required + Wrong password diff --git a/src/com/owncloud/android/authentication/SsoWebViewClient.java b/src/com/owncloud/android/authentication/SsoWebViewClient.java index 83f70ac9..685fb1e4 100644 --- a/src/com/owncloud/android/authentication/SsoWebViewClient.java +++ b/src/com/owncloud/android/authentication/SsoWebViewClient.java @@ -45,6 +45,7 @@ import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.EditText; import android.widget.LinearLayout; +import android.widget.Toast; import com.owncloud.android.R; import com.owncloud.android.lib.common.network.NetworkUtils; @@ -73,6 +74,8 @@ public class SsoWebViewClient extends WebViewClient { private WeakReference mListenerRef; private String mTargetUrl; private String mLastReloadedUrlAtError; + + private boolean mIsFirstAttempt; public SsoWebViewClient (Context context, Handler listenerHandler, SsoWebViewClientListener listener) { mContext = context; @@ -80,6 +83,7 @@ public class SsoWebViewClient extends WebViewClient { mListenerRef = new WeakReference(listener); mTargetUrl = "fake://url.to.be.set"; mLastReloadedUrlAtError = null; + mIsFirstAttempt = true; } public String getTargetUrl() { @@ -202,10 +206,14 @@ public class SsoWebViewClient extends WebViewClient { @Override public void onReceivedHttpAuthRequest (WebView view, HttpAuthHandler handler, String host, String realm) { Log_OC.d(TAG, "onReceivedHttpAuthRequest : " + host); -// Toast.makeText(mContext, "onReceivedHttpAuthRequest : " + host, Toast.LENGTH_LONG).show(); createAuthenticationDialog(view, handler); + if (!mIsFirstAttempt) { + Toast.makeText(mContext, mContext.getText(R.string.saml_authentication_wrong_pass), Toast.LENGTH_LONG).show(); + } else { + mIsFirstAttempt = false; + } } @Override @@ -287,6 +295,7 @@ public class SsoWebViewClient extends WebViewClient { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); mWebView.stopLoading(); + mIsFirstAttempt = true; } });