mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-09-01 06:45:19 +00:00
Disallow overwriting passwords when editing (#1286)
Co-authored-by: Aditya Wasan <adityawasan55@gmail.com>
This commit is contained in:
@@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Connection attempts now use a reasonable 10 second timeout as opposed to the default of 30 seconds
|
- Connection attempts now use a reasonable 10 second timeout as opposed to the default of 30 seconds
|
||||||
- A change to the remote host key for a server would prevent the user from being able to connect to it
|
- A change to the remote host key for a server would prevent the user from being able to connect to it
|
||||||
- Pressing the back button in the navigation bar and the one in the toolbar behaved differently
|
- Pressing the back button in the navigation bar and the one in the toolbar behaved differently
|
||||||
|
- Editing a password allowed accidentally overwriting an existing one
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@@ -398,7 +398,10 @@ class PasswordCreationActivity : BasePgpActivity(), OpenPgpServiceConnection.OnB
|
|||||||
runCatching {
|
runCatching {
|
||||||
val file = File(path)
|
val file = File(path)
|
||||||
// If we're not editing, this file should not already exist!
|
// If we're not editing, this file should not already exist!
|
||||||
if (!editing && file.exists()) {
|
// Additionally, if we were editing and the incoming and outgoing
|
||||||
|
// filenames differ, it means we renamed. Ensure that the target
|
||||||
|
// doesn't already exist to prevent an accidental overwrite.
|
||||||
|
if ((!editing || (editing && suggestedName != file.nameWithoutExtension)) && file.exists()) {
|
||||||
snackbar(message = getString(R.string.password_creation_duplicate_error))
|
snackbar(message = getString(R.string.password_creation_duplicate_error))
|
||||||
return@executeApiAsync
|
return@executeApiAsync
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user