From d1fc13ad3abc0d086ba41b4811222dd7a97ebd00 Mon Sep 17 00:00:00 2001 From: David Development Date: Sun, 14 Feb 2016 10:28:15 +0100 Subject: [PATCH] Fix #489 (Security Fix) --- .../LoginDialogFragment.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/LoginDialogFragment.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/LoginDialogFragment.java index e2b8423a..48867d3d 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/LoginDialogFragment.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/LoginDialogFragment.java @@ -32,8 +32,10 @@ import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; +import android.text.Editable; import android.text.InputType; import android.text.TextUtils; +import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; @@ -146,6 +148,7 @@ public class LoginDialogFragment extends DialogFragment implements IAccountImpor } mImageViewShowPwd.setOnClickListener(ImgViewShowPasswordListener); + mPasswordView.addTextChangedListener(PasswordTextChangedListener); SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity()); mUsername = mPrefs.getString(SettingsActivity.EDT_USERNAME_STRING, null); @@ -153,6 +156,10 @@ public class LoginDialogFragment extends DialogFragment implements IAccountImpor mOc_root_path = mPrefs.getString(SettingsActivity.EDT_OWNCLOUDROOTPATH_STRING, null); mCbDisableHostnameVerification = mPrefs.getBoolean(SettingsActivity.CB_DISABLE_HOSTNAME_VERIFICATION_STRING, false); + if(!mPassword.isEmpty()) { + mImageViewShowPwd.setVisibility(View.GONE); + } + // Set up the login form. mUsernameView.setText(mUsername); mPasswordView.setText(mPassword); @@ -210,6 +217,25 @@ public class LoginDialogFragment extends DialogFragment implements IAccountImpor mActivity.finish(); } + private TextWatcher PasswordTextChangedListener = new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + if(s.toString().isEmpty()) { + mImageViewShowPwd.setVisibility(View.VISIBLE); + } + } + }; + private View.OnClickListener ImgViewShowPasswordListener = new View.OnClickListener() { @Override public void onClick(View v) {