aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-04-20 13:29:10 +0530
committerGitHub <noreply@github.com>2020-04-20 13:29:10 +0530
commit47c2875e931a1cd0389d3d21e110beb3a65c0f53 (patch)
treee50e01135b02ece7dcdaa2623bfa730b51220c87 /app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt
parent99aa0d9bb2b3af2e48fcea04bc5cee8b03a7b75a (diff)
downloadHardenedPass-47c2875e931a1cd0389d3d21e110beb3a65c0f53.tar.gz
HardenedPass-47c2875e931a1cd0389d3d21e110beb3a65c0f53.zip
Fix protocol validation (#726)
* GitOperation: code cleanup * WIP: Fix validation * Fixup SSH validation * Spotless * Remove logging of MalformedURLException Co-authored-by: Fabian Henneke <fabian@henneke.me> Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt10
1 files changed, 4 insertions, 6 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt b/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt
index 78a9ca69..e115c482 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt
@@ -183,9 +183,8 @@ abstract class GitOperation(fileDir: File, internal val callingActivity: Activit
.setView(dialogView)
.setPositiveButton(callingActivity.resources.getString(R.string.dialog_ok)) { _, _ ->
if (keyPair.decrypt(passphrase.text.toString())) {
- val rememberPassphrase = dialogView.findViewById<MaterialCheckBox>(R.id.git_auth_remember_passphrase).isChecked
- if (rememberPassphrase) {
- encryptedSettings.edit().putString("ssh_key_local_passphrase", passphrase.text.toString()).apply()
+ if (dialogView.findViewById<MaterialCheckBox>(R.id.git_auth_remember_passphrase).isChecked) {
+ encryptedSettings.edit { putString("ssh_key_local_passphrase", passphrase.text.toString()) }
}
// Authenticate using the ssh-key and then execute the command
setAuthentication(sshKey, username, passphrase.text.toString()).execute()
@@ -233,9 +232,8 @@ abstract class GitOperation(fileDir: File, internal val callingActivity: Activit
.setMessage(callingActivity.resources.getString(R.string.password_dialog_text))
.setView(dialogView)
.setPositiveButton(callingActivity.resources.getString(R.string.dialog_ok)) { _, _ ->
- val rememberPassphrase = dialogView.findViewById<MaterialCheckBox>(R.id.git_auth_remember_passphrase).isChecked
- if (rememberPassphrase) {
- encryptedSettings.edit().putString("https_password", passwordView.text.toString()).apply()
+ if (dialogView.findViewById<MaterialCheckBox>(R.id.git_auth_remember_passphrase).isChecked) {
+ encryptedSettings.edit { putString("https_password", passwordView.text.toString()) }
}
// authenticate using the user/pwd and then execute the command
setAuthentication(username, passwordView.text.toString()).execute()