Correctly set error on incorrect credentials (#972)
This commit is contained in:
parent
9f8f9d588c
commit
2b1f101685
3 changed files with 5 additions and 4 deletions
|
@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
- Properly handle cases where files contain only TOTP secrets and no password
|
- Properly handle cases where files contain only TOTP secrets and no password
|
||||||
- Allow creating nested directories directly
|
- Allow creating nested directories directly
|
||||||
|
- I keep saying this but for real: error message for wrong SSH/HTTPS password is properly fixed now
|
||||||
|
|
||||||
## [1.10.1] - 2020-07-23
|
## [1.10.1] - 2020-07-23
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,12 @@ import android.content.Intent
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import com.google.android.material.checkbox.MaterialCheckBox
|
import com.google.android.material.checkbox.MaterialCheckBox
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
import com.zeapo.pwdstore.R
|
import com.zeapo.pwdstore.R
|
||||||
import com.zeapo.pwdstore.UserPreference
|
import com.zeapo.pwdstore.UserPreference
|
||||||
import com.zeapo.pwdstore.git.config.ConnectionMode
|
import com.zeapo.pwdstore.git.config.ConnectionMode
|
||||||
|
@ -37,7 +37,6 @@ import org.eclipse.jgit.transport.CredentialItem
|
||||||
import org.eclipse.jgit.transport.CredentialsProvider
|
import org.eclipse.jgit.transport.CredentialsProvider
|
||||||
import org.eclipse.jgit.transport.SshSessionFactory
|
import org.eclipse.jgit.transport.SshSessionFactory
|
||||||
import org.eclipse.jgit.transport.URIish
|
import org.eclipse.jgit.transport.URIish
|
||||||
import com.google.android.material.R as materialR
|
|
||||||
|
|
||||||
|
|
||||||
private class GitOperationCredentialFinder(
|
private class GitOperationCredentialFinder(
|
||||||
|
@ -78,13 +77,13 @@ private class GitOperationCredentialFinder(
|
||||||
|
|
||||||
@SuppressLint("InflateParams")
|
@SuppressLint("InflateParams")
|
||||||
val dialogView = layoutInflater.inflate(R.layout.git_credential_layout, null)
|
val dialogView = layoutInflater.inflate(R.layout.git_credential_layout, null)
|
||||||
|
val credentialLayout = dialogView.findViewById<TextInputLayout>(R.id.git_auth_passphrase_layout)
|
||||||
val editCredential = dialogView.findViewById<TextInputEditText>(R.id.git_auth_credential)
|
val editCredential = dialogView.findViewById<TextInputEditText>(R.id.git_auth_credential)
|
||||||
editCredential.setHint(hintRes)
|
editCredential.setHint(hintRes)
|
||||||
val rememberCredential = dialogView.findViewById<MaterialCheckBox>(R.id.git_auth_remember_credential)
|
val rememberCredential = dialogView.findViewById<MaterialCheckBox>(R.id.git_auth_remember_credential)
|
||||||
rememberCredential.setText(rememberRes)
|
rememberCredential.setText(rememberRes)
|
||||||
if (isRetry)
|
if (isRetry)
|
||||||
editCredential.setError(callingActivity.resources.getString(errorRes),
|
credentialLayout.error = callingActivity.resources.getString(errorRes)
|
||||||
ContextCompat.getDrawable(callingActivity, materialR.drawable.mtrl_ic_error))
|
|
||||||
MaterialAlertDialogBuilder(callingActivity).run {
|
MaterialAlertDialogBuilder(callingActivity).run {
|
||||||
setTitle(R.string.passphrase_dialog_title)
|
setTitle(R.string.passphrase_dialog_title)
|
||||||
setMessage(messageRes)
|
setMessage(messageRes)
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:endIconMode="password_toggle"
|
app:endIconMode="password_toggle"
|
||||||
app:hintEnabled="true"
|
app:hintEnabled="true"
|
||||||
|
app:errorEnabled="true"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
Loading…
Reference in a new issue