This commit is contained in:
Dain Nilsson 2022-06-07 15:07:03 +02:00
commit ee95c828d8
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8
6 changed files with 24 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -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');

View File

@ -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

View File

@ -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: () {

View File

@ -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),