Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyrat committed Jan 25, 2025
1 parent ae528f2 commit 904bf54
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/cubit/vault_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1649,6 +1649,7 @@ class VaultCubit extends Cubit<VaultState> {
state is VaultRefreshCredentialsRequired ||
state is VaultBackgroundError ||
state is VaultSaving) {
emitError('Please wait a moment until background vault updates have completed.', toast: true);
return false;
}
if (!currentVaultFile!.files.current.isDirty && _entryCubit.state is! EntryLoaded) {
Expand Down
8 changes: 8 additions & 0 deletions lib/vault_backend/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ String hex2base64(String input) {
return base64.encode(hex.decode(input));
}

T? tryCast<T>(dynamic value) {
try {
return (value as T);
} on TypeError catch (_) {
return null;
}
}

const EMAIL_AUTH_SALT = '4e1cc573ed8cd48a19beb6ec6729be6c7a19c91a40c6483be3c9d671b5fbae9a';
const PASS_AUTH_SALT = 'a90b6364315150a39a60d324bfafe6f4444deb15bee194a6d34726c31493dacc';
const STRETCH_SALT = '509d04a4c27ea9947335e7aa45aabe4fcc2222c87daf0f0520712cefb000124a';
3 changes: 2 additions & 1 deletion lib/widgets/change_password.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:kdbx/kdbx.dart';
import 'package:keevault/cubit/account_cubit.dart';
import '../cubit/vault_cubit.dart';
import '../generated/l10n.dart';
import '../vault_backend/utils.dart';
import '../widgets/password_strength.dart';
import 'coloured_safe_area_widget.dart';

Expand Down Expand Up @@ -178,7 +179,7 @@ class _ChangePasswordWidgetState extends State<ChangePasswordWidget> {
child: Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: Text(
(state as VaultChangingPassword).error ?? '',
tryCast<VaultChangingPassword>(state)?.error ?? '',
style: theme.textTheme.titleMedium?.copyWith(color: theme.colorScheme.error),
)),
),
Expand Down

0 comments on commit 904bf54

Please sign in to comment.