1
0
Fork 0
mirror of https://github.com/Corewala/Buran synced 2024-12-22 07:42:43 +00:00

Made preferences less vulnerable to accidentally changing certificates

This commit is contained in:
Corewala 2023-02-20 16:14:17 -05:00
parent df6c159c2c
commit bedbc9fb98

View file

@ -365,7 +365,7 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply { val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
addCategory(Intent.CATEGORY_OPENABLE) addCategory(Intent.CATEGORY_OPENABLE)
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
type = "*/*" type = "application/x-pkcs12"
} }
startActivityForResult(intent, PREFS_SET_CLIENT_CERT_REQ) startActivityForResult(intent, PREFS_SET_CLIENT_CERT_REQ)
true true
@ -373,7 +373,6 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
certificateCategory.addPreference(clientCertPref) certificateCategory.addPreference(clientCertPref)
val clientCertPassword = EditTextPreference(context) val clientCertPassword = EditTextPreference(context)
clientCertPassword.key = Buran.PREF_KEY_CLIENT_CERT_PASSWORD clientCertPassword.key = Buran.PREF_KEY_CLIENT_CERT_PASSWORD
clientCertPassword.title = getString(R.string.client_certificate_password) clientCertPassword.title = getString(R.string.client_certificate_password)
@ -399,7 +398,6 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
useBiometrics.isVisible = false useBiometrics.isVisible = false
certificateCategory.addPreference(useBiometrics) certificateCategory.addPreference(useBiometrics)
val passwordCiphertext = EditTextPreference(context) val passwordCiphertext = EditTextPreference(context)
passwordCiphertext.key = "password_ciphertext" passwordCiphertext.key = "password_ciphertext"
passwordCiphertext.isVisible = false passwordCiphertext.isVisible = false
@ -445,6 +443,7 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
clientCertPassword.summary = getDots(clientCertPassword.text) clientCertPassword.summary = getDots(clientCertPassword.text)
} }
clientCertPassword.isVisible = !(newValue as Boolean) clientCertPassword.isVisible = !(newValue as Boolean)
clientCertPref.isEnabled = !(newValue as Boolean)
} }
} }
@ -497,7 +496,6 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
persistPermissions(uri) persistPermissions(uri)
findFilename(uri) findFilename(uri)
} }
} }
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)
} }