From 0d2c6654d34d08ff1b24a3b0adda9a3e85df2214 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 4 Sep 2020 15:49:45 +0530 Subject: Assorted UX improvements (#1077) * CredentialFinder: allow seeing password when retrying Signed-off-by: Harsh Shandilya * GitOperation: bail out early when SSH key is missing Signed-off-by: Harsh Shandilya * OnboardingActivity: finish all activities in onBackPressed Signed-off-by: Harsh Shandilya * Update CHANGELOG Signed-off-by: Harsh Shandilya --- CHANGELOG.md | 1 + app/src/main/java/com/zeapo/pwdstore/OnboardingActivity.kt | 4 ++++ .../main/java/com/zeapo/pwdstore/git/operation/CredentialFinder.kt | 6 +++++- app/src/main/java/com/zeapo/pwdstore/git/operation/GitOperation.kt | 3 +++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 037bbbec..3c762dc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ All notable changes to this project will be documented in this file. - Git server protocol and authentication mode are only updated when explicitly saved - Remember HTTPS password during a sync operation +- Unable to use show/hide password option for password/passphrase after first attempt was wrong ## [1.11.3] - 2020-08-27 diff --git a/app/src/main/java/com/zeapo/pwdstore/OnboardingActivity.kt b/app/src/main/java/com/zeapo/pwdstore/OnboardingActivity.kt index d2f19b7a..ed05ed0d 100644 --- a/app/src/main/java/com/zeapo/pwdstore/OnboardingActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/OnboardingActivity.kt @@ -81,6 +81,10 @@ class OnboardingActivity : AppCompatActivity() { } } + override fun onBackPressed() { + finishAffinity() + } + /** * Clones a remote Git repository to the app's private directory */ diff --git a/app/src/main/java/com/zeapo/pwdstore/git/operation/CredentialFinder.kt b/app/src/main/java/com/zeapo/pwdstore/git/operation/CredentialFinder.kt index 6ac5cba3..742361c0 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/operation/CredentialFinder.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/operation/CredentialFinder.kt @@ -4,6 +4,7 @@ import android.annotation.SuppressLint import android.view.LayoutInflater import androidx.annotation.StringRes import androidx.core.content.edit +import androidx.core.widget.doOnTextChanged import androidx.fragment.app.FragmentActivity import com.google.android.material.checkbox.MaterialCheckBox import com.google.android.material.dialog.MaterialAlertDialogBuilder @@ -61,8 +62,11 @@ class CredentialFinder( editCredential.setHint(hintRes) val rememberCredential = dialogView.findViewById(R.id.git_auth_remember_credential) rememberCredential.setText(rememberRes) - if (isRetry) + if (isRetry) { credentialLayout.error = callingActivity.resources.getString(errorRes) + // Reset error when user starts entering a password + editCredential.doOnTextChanged { _, _, _, _ -> credentialLayout.error = null } + } MaterialAlertDialogBuilder(callingActivity).run { setTitle(R.string.passphrase_dialog_title) setMessage(messageRes) 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 2a72005e..32a94d73 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 @@ -176,6 +176,9 @@ abstract class GitOperation(protected val callingActivity: FragmentActivity) { } } else { onMissingSshKeyFile() + // This would correctly cancel the operation but won't surface a user-visible + // error, allowing users to make the SSH key selection. + return Err(SSHException(DisconnectReason.AUTH_CANCELLED_BY_USER)) } AuthMode.OpenKeychain -> registerAuthProviders(SshAuthData.OpenKeychain(callingActivity)) AuthMode.Password -> { -- cgit v1.2.3