mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-27 06:14:58 +03:00
Merge PR #143
This commit is contained in:
commit
ee95c828d8
BIN
assets/graphics/manage-accounts.png
Executable file
BIN
assets/graphics/manage-accounts.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.5 KiB |
@ -1,8 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
final Image noAccounts = _graphic('no-accounts');
|
||||
final Image noDiscoverable = _graphic('no-discoverable');
|
||||
final Image noFingerprints = _graphic('no-fingerprints');
|
||||
final Image noPermission = _graphic('no-permission');
|
||||
final Image manageAccounts = _graphic('manage-accounts');
|
||||
|
||||
Image _graphic(String name) => Image.asset('assets/graphics/$name.png');
|
||||
|
@ -5,6 +5,7 @@ import '../../app/models.dart';
|
||||
import '../../app/views/app_failure_page.dart';
|
||||
import '../../app/views/app_loading_screen.dart';
|
||||
import '../../app/views/app_page.dart';
|
||||
import '../../app/views/graphics.dart';
|
||||
import '../../app/views/message_page.dart';
|
||||
import '../../management/models.dart';
|
||||
import '../state.dart';
|
||||
@ -28,11 +29,11 @@ class FidoScreen extends ConsumerWidget {
|
||||
.info.supportedCapabilities[deviceData.node.transport] ??
|
||||
0;
|
||||
if (Capability.fido2.value & supported == 0) {
|
||||
return const MessagePage(
|
||||
title: Text('WebAuthn'),
|
||||
header: 'No management options',
|
||||
message:
|
||||
'WebAuthn is supported by this device, but there are no management options available.',
|
||||
return MessagePage(
|
||||
title: const Text('WebAuthn'),
|
||||
graphic: manageAccounts,
|
||||
header: 'Ready to use',
|
||||
message: 'Register as a Security Key on websites',
|
||||
);
|
||||
}
|
||||
final enabled = deviceData.info.config
|
||||
|
@ -26,14 +26,14 @@ class FidoLockedPage extends ConsumerWidget {
|
||||
title: const Text('WebAuthn'),
|
||||
graphic: noFingerprints,
|
||||
header: 'No fingerprints',
|
||||
message: 'Set a PIN to register fingerprints.',
|
||||
message: 'Set a PIN to register fingerprints',
|
||||
actions: _buildActions(context),
|
||||
);
|
||||
} else {
|
||||
return MessagePage(
|
||||
title: const Text('WebAuthn'),
|
||||
graphic: noDiscoverable,
|
||||
header: 'No discoverable accounts',
|
||||
graphic: manageAccounts,
|
||||
header: state.credMgmt ? 'No discoverable accounts' : 'Ready to use',
|
||||
message:
|
||||
'Optionally set a PIN to protect access to your YubiKey\nRegister as a Security Key on websites',
|
||||
actions: _buildActions(context),
|
||||
@ -41,6 +41,16 @@ class FidoLockedPage extends ConsumerWidget {
|
||||
}
|
||||
}
|
||||
|
||||
if (!state.credMgmt && state.bioEnroll == null) {
|
||||
return MessagePage(
|
||||
title: const Text('WebAuthn'),
|
||||
graphic: manageAccounts,
|
||||
header: 'Ready to use',
|
||||
message: 'Register as a Security Key on websites',
|
||||
actions: _buildActions(context),
|
||||
);
|
||||
}
|
||||
|
||||
return AppPage(
|
||||
title: const Text('WebAuthn'),
|
||||
actions: _buildActions(context),
|
||||
@ -56,7 +66,9 @@ class FidoLockedPage extends ConsumerWidget {
|
||||
List<Widget> _buildActions(BuildContext context) => [
|
||||
if (!state.hasPin)
|
||||
OutlinedButton.icon(
|
||||
style: AppTheme.primaryOutlinedButtonStyle(context),
|
||||
style: state.bioEnroll != null
|
||||
? AppTheme.primaryOutlinedButtonStyle(context)
|
||||
: null,
|
||||
label: const Text('Set PIN'),
|
||||
icon: const Icon(Icons.pin),
|
||||
onPressed: () {
|
||||
|
@ -139,7 +139,7 @@ class FidoUnlockedPage extends ConsumerWidget {
|
||||
|
||||
return MessagePage(
|
||||
title: const Text('WebAuthn'),
|
||||
graphic: noDiscoverable,
|
||||
graphic: manageAccounts,
|
||||
header: 'No discoverable accounts',
|
||||
message: 'Register as a Security Key on websites',
|
||||
actions: _buildActions(context),
|
||||
|
Loading…
Reference in New Issue
Block a user