Show a dialog if the DB key can't be decrypted due to a keystore error.

This commit is contained in:
akwizgran
2020-02-25 14:56:32 +00:00
parent 1546a05568
commit ed50582e27
25 changed files with 452 additions and 293 deletions

View File

@@ -4,6 +4,7 @@ import com.github.ajalt.clikt.core.UsageError
import com.github.ajalt.clikt.output.TermUi.echo
import com.github.ajalt.clikt.output.TermUi.prompt
import org.briarproject.bramble.api.account.AccountManager
import org.briarproject.bramble.api.crypto.DecryptionException
import org.briarproject.bramble.api.crypto.PasswordStrengthEstimator
import org.briarproject.bramble.api.crypto.PasswordStrengthEstimator.QUITE_WEAK
import org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH
@@ -34,7 +35,9 @@ constructor(
} else {
val password = prompt("Password", hideInput = true)
?: throw UsageError("Could not get password. Is STDIN connected?")
if (!accountManager.signIn(password)) {
try {
accountManager.signIn(password)
} catch (e : DecryptionException) {
echo("Error: Password invalid")
exitProcess(1)
}