1
0
Fork 0
mirror of https://github.com/Corewala/Buran synced 2024-12-21 23:32:40 +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 {
addCategory(Intent.CATEGORY_OPENABLE)
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
type = "*/*"
type = "application/x-pkcs12"
}
startActivityForResult(intent, PREFS_SET_CLIENT_CERT_REQ)
true
@ -373,7 +373,6 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
certificateCategory.addPreference(clientCertPref)
val clientCertPassword = EditTextPreference(context)
clientCertPassword.key = Buran.PREF_KEY_CLIENT_CERT_PASSWORD
clientCertPassword.title = getString(R.string.client_certificate_password)
@ -399,7 +398,6 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
useBiometrics.isVisible = false
certificateCategory.addPreference(useBiometrics)
val passwordCiphertext = EditTextPreference(context)
passwordCiphertext.key = "password_ciphertext"
passwordCiphertext.isVisible = false
@ -445,6 +443,7 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
clientCertPassword.summary = getDots(clientCertPassword.text)
}
clientCertPassword.isVisible = !(newValue as Boolean)
clientCertPref.isEnabled = !(newValue as Boolean)
}
}
@ -497,7 +496,6 @@ class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChang
persistPermissions(uri)
findFilename(uri)
}
}
super.onActivityResult(requestCode, resultCode, data)
}