mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 10:11:52 +03:00
Add Windows Settings button for FIDO
This commit is contained in:
parent
02a3bc3a57
commit
1c3ac84afb
@ -23,8 +23,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../desktop/models.dart';
|
||||
import '../../desktop/state.dart';
|
||||
import '../../management/models.dart';
|
||||
import '../message.dart';
|
||||
import '../state.dart';
|
||||
import 'elevate_fido_buttons.dart';
|
||||
import 'message_page.dart';
|
||||
|
||||
class AppFailurePage extends ConsumerWidget {
|
||||
@ -69,31 +69,7 @@ class AppFailurePage extends ConsumerWidget {
|
||||
centered = false;
|
||||
graphic = null;
|
||||
actions = [
|
||||
FilledButton.icon(
|
||||
label: Text(l10n.s_unlock),
|
||||
icon: const Icon(Icons.lock_open),
|
||||
onPressed: () async {
|
||||
final closeMessage = showMessage(
|
||||
context, l10n.l_elevating_permissions,
|
||||
duration: const Duration(seconds: 30));
|
||||
try {
|
||||
if (await ref.read(rpcProvider).requireValue.elevate()) {
|
||||
ref.invalidate(rpcProvider);
|
||||
} else {
|
||||
await ref.read(withContextProvider)(
|
||||
(context) async {
|
||||
showMessage(
|
||||
context,
|
||||
l10n.s_permission_denied,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
closeMessage();
|
||||
}
|
||||
},
|
||||
),
|
||||
const ElevateFidoButtons(),
|
||||
];
|
||||
}
|
||||
break;
|
||||
|
@ -22,9 +22,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../core/models.dart';
|
||||
import '../../desktop/state.dart';
|
||||
import '../message.dart';
|
||||
import '../models.dart';
|
||||
import '../state.dart';
|
||||
import 'elevate_fido_buttons.dart';
|
||||
import 'message_page.dart';
|
||||
|
||||
class DeviceErrorScreen extends ConsumerWidget {
|
||||
@ -44,25 +44,7 @@ class DeviceErrorScreen extends ConsumerWidget {
|
||||
header: l10n.s_admin_privileges_required,
|
||||
message: l10n.p_elevated_permissions_required,
|
||||
actionsBuilder: (context, expanded) => [
|
||||
FilledButton.icon(
|
||||
label: Text(l10n.s_unlock),
|
||||
icon: const Icon(Icons.lock_open),
|
||||
onPressed: () async {
|
||||
final closeMessage = showMessage(
|
||||
context, l10n.l_elevating_permissions,
|
||||
duration: const Duration(seconds: 30));
|
||||
try {
|
||||
if (await ref.read(rpcProvider).requireValue.elevate()) {
|
||||
ref.invalidate(rpcProvider);
|
||||
} else {
|
||||
await ref.read(withContextProvider)((context) async =>
|
||||
showMessage(context, l10n.s_permission_denied));
|
||||
}
|
||||
} finally {
|
||||
closeMessage();
|
||||
}
|
||||
},
|
||||
),
|
||||
const ElevateFidoButtons(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
71
lib/app/views/elevate_fido_buttons.dart
Normal file
71
lib/app/views/elevate_fido_buttons.dart
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Yubico.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../desktop/state.dart';
|
||||
import '../message.dart';
|
||||
import '../state.dart';
|
||||
|
||||
class ElevateFidoButtons extends ConsumerWidget {
|
||||
const ElevateFidoButtons({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
return Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 4,
|
||||
children: [
|
||||
FilledButton.icon(
|
||||
label: Text(l10n.s_request_access),
|
||||
icon: const Icon(Icons.lock_open),
|
||||
onPressed: () async {
|
||||
final closeMessage = showMessage(
|
||||
context, l10n.l_elevating_permissions,
|
||||
duration: const Duration(seconds: 30));
|
||||
try {
|
||||
if (await ref.read(rpcProvider).requireValue.elevate()) {
|
||||
ref.invalidate(rpcProvider);
|
||||
} else {
|
||||
await ref.read(withContextProvider)((context) async =>
|
||||
showMessage(context, l10n.s_permission_denied));
|
||||
}
|
||||
} finally {
|
||||
closeMessage();
|
||||
}
|
||||
},
|
||||
),
|
||||
OutlinedButton.icon(
|
||||
label: Text(l10n.s_open_windows_settings),
|
||||
icon: const Icon(Icons.open_in_new),
|
||||
onPressed: () async {
|
||||
await Process.start('powershell.exe', [
|
||||
'-NoProfile',
|
||||
'-Command',
|
||||
'Start',
|
||||
'ms-settings:signinoptions-launchsecuritykeyenrollment'
|
||||
]);
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -596,9 +596,11 @@
|
||||
|
||||
"@_permissions": {},
|
||||
"s_enable_nfc": "NFC aktivieren",
|
||||
"s_request_access": null,
|
||||
"s_permission_denied": "Zugriff verweigert",
|
||||
"l_elevating_permissions": "Erhöhe Berechtigungen\u2026",
|
||||
"s_review_permissions": "Berechtigungen überprüfen",
|
||||
"s_open_windows_settings": null,
|
||||
"s_admin_privileges_required": null,
|
||||
"p_elevated_permissions_required": "Die Verwaltung dieses Geräts benötigt erhöhte Berechtigungen.",
|
||||
"p_webauthn_elevated_permissions_required": "WebAuthn-Verwaltung benötigt erhöhte Berechtigungen.",
|
||||
|
@ -596,12 +596,14 @@
|
||||
|
||||
"@_permissions": {},
|
||||
"s_enable_nfc": "Enable NFC",
|
||||
"s_request_access": "Request access",
|
||||
"s_permission_denied": "Permission denied",
|
||||
"l_elevating_permissions": "Elevating permissions\u2026",
|
||||
"s_review_permissions": "Review permissions",
|
||||
"s_admin_privileges_required": "Admin privileges required",
|
||||
"p_elevated_permissions_required": "Managing this device requires elevated privileges.",
|
||||
"p_webauthn_elevated_permissions_required": "WebAuthn management requires elevated privileges.",
|
||||
"s_open_windows_settings": "Open Windows settings",
|
||||
"s_admin_privileges_required": "Administrator privileges required",
|
||||
"p_elevated_permissions_required": "Managing this device requires elevated privileges. Alternatively, you can use Windows Settings to manage FIDO configuration.",
|
||||
"p_webauthn_elevated_permissions_required": "WebAuthn management requires elevated privileges. Alternatively, you can use Windows Settings to manage FIDO configuration.",
|
||||
"p_need_camera_permission": "Yubico Authenticator needs Camera permissions for scanning QR codes.",
|
||||
|
||||
"@_qr_codes": {},
|
||||
|
@ -596,9 +596,11 @@
|
||||
|
||||
"@_permissions": {},
|
||||
"s_enable_nfc": "Activer le NFC",
|
||||
"s_request_access": null,
|
||||
"s_permission_denied": "Permission refusée",
|
||||
"l_elevating_permissions": "Élevation des permissions\u2026",
|
||||
"s_review_permissions": "Révision des permissions",
|
||||
"s_open_windows_settings": null,
|
||||
"s_admin_privileges_required": null,
|
||||
"p_elevated_permissions_required": "Gérer cet appareil demande des privilèges plus élevés.",
|
||||
"p_webauthn_elevated_permissions_required": "La gestion WebAuthn demande des privilèges plus élevés.",
|
||||
|
@ -596,9 +596,11 @@
|
||||
|
||||
"@_permissions": {},
|
||||
"s_enable_nfc": "NFCを有効にする",
|
||||
"s_request_access": null,
|
||||
"s_permission_denied": "権限がありません",
|
||||
"l_elevating_permissions": "権限の昇格\u2026",
|
||||
"s_review_permissions": "権限の確認",
|
||||
"s_open_windows_settings": null,
|
||||
"s_admin_privileges_required": null,
|
||||
"p_elevated_permissions_required": "このデバイスを管理するには権限の昇格が必要です",
|
||||
"p_webauthn_elevated_permissions_required": "WebAuthn管理には権限の昇格が必要です",
|
||||
|
@ -596,9 +596,11 @@
|
||||
|
||||
"@_permissions": {},
|
||||
"s_enable_nfc": "Włącz NFC",
|
||||
"s_request_access": null,
|
||||
"s_permission_denied": "Odmowa dostępu",
|
||||
"l_elevating_permissions": "Podnoszenie uprawnień\u2026",
|
||||
"s_review_permissions": "Przegląd uprawnień",
|
||||
"s_open_windows_settings": null,
|
||||
"s_admin_privileges_required": "Wymagane uprawnienia administratora",
|
||||
"p_elevated_permissions_required": "Zarządzanie tym urządzeniem wymaga podwyższonych uprawnień.",
|
||||
"p_webauthn_elevated_permissions_required": "Zarządzanie WebAuthn wymaga podwyższonych uprawnień.",
|
||||
|
Loading…
Reference in New Issue
Block a user