aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt
diff options
context:
space:
mode:
authorFabian Henneke <FabianHenneke@users.noreply.github.com>2020-05-28 06:27:30 +0200
committerGitHub <noreply@github.com>2020-05-28 09:57:30 +0530
commit97911c587754a7c11e594004b77c4ac53af8a468 (patch)
tree680453c63fc3873139a3937268f73ec6985cf03a /app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt
parentfea82fed47d87138a9a24eb0358fc9a917474dc7 (diff)
downloadHardenedPass-97911c587754a7c11e594004b77c4ac53af8a468.tar.gz
HardenedPass-97911c587754a7c11e594004b77c4ac53af8a468.zip
Use SSHJ for SSH public key authentication (#801)
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt b/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt
index fb7d7e82..c75f7ad3 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt
@@ -146,10 +146,11 @@ abstract class BaseGitActivity : AppCompatActivity() {
}
if (PasswordRepository.isInitialized)
PasswordRepository.addRemote("origin", newUrl, true)
- // HTTPS authentication sends the password to the server, so we must wipe the password when
- // the server is changed.
- if (previousUrl.isNotEmpty() && newUrl != previousUrl && protocol == Protocol.Https)
+ // When the server changes, remote password and host key file should be deleted.
+ if (previousUrl.isNotEmpty() && newUrl != previousUrl) {
encryptedSettings.edit { remove("https_password") }
+ File("$filesDir/.host_key").delete()
+ }
url = newUrl
return GitUpdateUrlResult.Ok
}
@@ -201,8 +202,7 @@ abstract class BaseGitActivity : AppCompatActivity() {
return
}
}
- op.executeAfterAuthentication(connectionMode, serverUser,
- File("$filesDir/.ssh_key"), identity)
+ op.executeAfterAuthentication(connectionMode, serverUser, identity)
} catch (e: Exception) {
e.printStackTrace()
MaterialAlertDialogBuilder(this).setMessage(e.message).show()