aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/autofill
diff options
context:
space:
mode:
authorFabian Henneke <FabianHenneke@users.noreply.github.com>2020-04-14 00:21:59 +0200
committerGitHub <noreply@github.com>2020-04-14 03:51:59 +0530
commit0d54a687d6e460bcad65d519ae0d49f8d1492c84 (patch)
tree2a894d120c866fa768bc76ec62b471c77f78723c /app/src/main/java/com/zeapo/pwdstore/autofill
parent11c7e369860a7ee2d5b0ca9e42c55dd232ac2f07 (diff)
downloadHardenedPass-0d54a687d6e460bcad65d519ae0d49f8d1492c84.tar.gz
HardenedPass-0d54a687d6e460bcad65d519ae0d49f8d1492c84.zip
Fix repository corruption by AutofillSaveActivity (#699)
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/autofill')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt49
1 files changed, 26 insertions, 23 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt
index 3a4831d6..c3132a79 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillSaveActivity.kt
@@ -120,31 +120,34 @@ class AutofillSaveActivity : Activity() {
AutofillMatcher.addMatchFor(this, it, File(createdPath))
}
val longName = data.getStringExtra("LONG_NAME")!!
- // PgpActivity delegates committing the added file to PasswordStore. Since PasswordStore
- // is not involved in an AutofillScenario, we have to commit the file ourself.
- PasswordStore.commitChange(this, getString(R.string.git_commit_add_text, longName))
-
- val password = data.getStringExtra("PASSWORD")
+ val password = data.getStringExtra("PASSWORD")!!
val username = data.getStringExtra("USERNAME")
- if (password != null) {
- val clientState =
- intent?.getBundleExtra(AutofillManager.EXTRA_CLIENT_STATE) ?: run {
- e { "AutofillDecryptActivity started without EXTRA_CLIENT_STATE" }
- finish()
- return
- }
- val credentials = Credentials(username, password)
- val fillInDataset = FillableForm.makeFillInDataset(
- this,
- credentials,
- clientState,
- AutofillAction.Generate
- )
- setResult(RESULT_OK, Intent().apply {
- putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillInDataset)
- })
+ val clientState =
+ intent?.getBundleExtra(AutofillManager.EXTRA_CLIENT_STATE) ?: run {
+ e { "AutofillDecryptActivity started without EXTRA_CLIENT_STATE" }
+ finish()
+ return
+ }
+ val credentials = Credentials(username, password)
+ val fillInDataset = FillableForm.makeFillInDataset(
+ this,
+ credentials,
+ clientState,
+ AutofillAction.Generate
+ )
+ val result = Intent().apply {
+ putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, fillInDataset)
}
+ // PgpActivity delegates committing the added file to PasswordStore. Since PasswordStore
+ // is not involved in an AutofillScenario, we have to commit the file ourselves.
+ PasswordStore.commitChange(
+ this,
+ getString(R.string.git_commit_add_text, longName),
+ finishWithResultOnEnd = result
+ )
+ // GitAsyncTask will finish the activity for us.
+ } else {
+ finish()
}
- finish()
}
}