chore: Improved error handling for recovery key
This commit is contained in:
parent
74b1553662
commit
2af8691536
2 changed files with 17 additions and 9 deletions
|
|
@ -266,6 +266,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
|||
),
|
||||
hintText: L10n.of(context)!.recoveryKey,
|
||||
errorText: _recoveryKeyInputError,
|
||||
errorMaxLines: 2,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
|
@ -290,6 +291,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
|||
final key = _recoveryKeyTextEditingController
|
||||
.text
|
||||
.trim();
|
||||
if (key.isEmpty) return;
|
||||
await bootstrap.newSsssKey!.unlock(
|
||||
keyOrPassphrase: key,
|
||||
);
|
||||
|
|
@ -317,6 +319,11 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
|||
() => _recoveryKeyInputError =
|
||||
e.toLocalizedString(context),
|
||||
);
|
||||
} on FormatException catch (_) {
|
||||
setState(
|
||||
() => _recoveryKeyInputError =
|
||||
L10n.of(context)!.wrongRecoveryKey,
|
||||
);
|
||||
} catch (e, s) {
|
||||
ErrorReporter(
|
||||
context,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue