mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-22 16:32:01 +03:00
[OATH] show correct button based on FIPS status
This commit is contained in:
parent
2e48131c9b
commit
4339c60fbd
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2023 Yubico.
|
* Copyright (C) 2023,2024 Yubico.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -28,7 +28,6 @@ import '../features.dart' as features;
|
|||||||
import '../icon_provider/icon_pack_dialog.dart';
|
import '../icon_provider/icon_pack_dialog.dart';
|
||||||
import '../keys.dart' as keys;
|
import '../keys.dart' as keys;
|
||||||
import '../models.dart';
|
import '../models.dart';
|
||||||
import 'manage_password_dialog.dart';
|
|
||||||
import 'utils.dart';
|
import 'utils.dart';
|
||||||
|
|
||||||
Widget oathBuildActions(
|
Widget oathBuildActions(
|
||||||
@ -105,11 +104,7 @@ Widget oathBuildActions(
|
|||||||
icon: const Icon(Symbols.password),
|
icon: const Icon(Symbols.password),
|
||||||
onTap: (context) {
|
onTap: (context) {
|
||||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||||
showBlurDialog(
|
setManagePassword(context, ref, devicePath, oathState);
|
||||||
context: context,
|
|
||||||
builder: (context) =>
|
|
||||||
ManagePasswordDialog(devicePath, oathState),
|
|
||||||
);
|
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
|
@ -186,8 +186,15 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
|||||||
|
|
||||||
if (numCreds == 0) {
|
if (numCreds == 0) {
|
||||||
return MessagePage(
|
return MessagePage(
|
||||||
actionsBuilder: (context, expanded) => [
|
actionsBuilder: (context, expanded) {
|
||||||
if (!expanded)
|
final (fipsCapable, fipsApproved) = ref
|
||||||
|
.watch(currentDeviceDataProvider)
|
||||||
|
.valueOrNull
|
||||||
|
?.info
|
||||||
|
.getFipsStatus(Capability.oath) ??
|
||||||
|
(false, false);
|
||||||
|
return [
|
||||||
|
if (!expanded && (!fipsCapable || (fipsCapable && fipsApproved)))
|
||||||
ActionChip(
|
ActionChip(
|
||||||
label: Text(l10n.s_add_account),
|
label: Text(l10n.s_add_account),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
@ -199,8 +206,18 @@ class _UnlockedViewState extends ConsumerState<_UnlockedView> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
avatar: const Icon(Symbols.person_add_alt),
|
avatar: const Icon(Symbols.person_add_alt),
|
||||||
|
),
|
||||||
|
if (!expanded && fipsCapable && !fipsApproved)
|
||||||
|
ActionChip(
|
||||||
|
label: Text(l10n.s_set_password),
|
||||||
|
onPressed: () async {
|
||||||
|
await setManagePassword(
|
||||||
|
context, ref, widget.devicePath, widget.oathState);
|
||||||
|
},
|
||||||
|
avatar: const Icon(Symbols.person_add_alt),
|
||||||
)
|
)
|
||||||
],
|
];
|
||||||
|
},
|
||||||
title: l10n.s_accounts,
|
title: l10n.s_accounts,
|
||||||
capabilities: const [Capability.oath],
|
capabilities: const [Capability.oath],
|
||||||
key: keys.noAccountsView,
|
key: keys.noAccountsView,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Yubico.
|
* Copyright (C) 2022-2024 Yubico.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -35,6 +35,7 @@ import '../models.dart';
|
|||||||
import 'add_account_dialog.dart';
|
import 'add_account_dialog.dart';
|
||||||
import 'add_account_page.dart';
|
import 'add_account_page.dart';
|
||||||
import 'add_multi_account_page.dart';
|
import 'add_multi_account_page.dart';
|
||||||
|
import 'manage_password_dialog.dart';
|
||||||
|
|
||||||
/// Calculates the available space for issuer and account name.
|
/// Calculates the available space for issuer and account name.
|
||||||
///
|
///
|
||||||
@ -178,3 +179,11 @@ Future<void> addOathAccount(BuildContext context, WidgetRef ref,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> setManagePassword(BuildContext context, WidgetRef ref,
|
||||||
|
DevicePath devicePath, OathState oathState) async {
|
||||||
|
await showBlurDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => ManagePasswordDialog(devicePath, oathState),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user