diff options
author | Fabian Henneke <FabianHenneke@users.noreply.github.com> | 2020-08-24 09:11:40 +0200 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2020-08-24 12:46:02 +0530 |
commit | e4ce435f002b866adb5f8c81a488816ef8a0d1d0 (patch) | |
tree | ce96a49b515b66faf55a1d2ad32b67236284e64d /app/src/main | |
parent | a29414fce6b192ab9a7a37938a9596b8511ce06b (diff) |
Return HTTPS URI username from CredentialsProvider (#1049)
Let the PasswordFinderCredentialsProvider support Username as a
CredentialItem type and return the user part of the repository URI when
it is requested.
(cherry picked from commit 679037b81dee889bdd3b79bd02c37353df63ccc5)
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt b/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt index 881b8807..62d6879c 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt @@ -58,6 +58,7 @@ abstract class GitOperation(gitDir: File, internal val callingActivity: Fragment override fun get(uri: URIish?, vararg items: CredentialItem): Boolean { for (item in items) { when (item) { + is CredentialItem.Username -> item.value = uri?.user is CredentialItem.Password -> item.value = passwordFinder.reqPassword(null) else -> UnsupportedCredentialItem(uri, item.javaClass.name) } @@ -66,7 +67,7 @@ abstract class GitOperation(gitDir: File, internal val callingActivity: Fragment } override fun supports(vararg items: CredentialItem) = items.all { - it is CredentialItem.Password + it is CredentialItem.Username || it is CredentialItem.Password } } |