Diagnose biometric: show real error on retry, disable sensitiveTransaction, enable useErrorDialogs for reliable OS prompt
This commit is contained in:
@@ -70,6 +70,22 @@ class _AuthScreenState extends State<AuthScreen> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Manual retry via button: show the REAL error so we can diagnose
|
||||||
|
/// why the OS dialog didn't appear.
|
||||||
|
Future<void> _retryBiometric() async {
|
||||||
|
setState(() => _bioMsg = null);
|
||||||
|
final (ok, err) = await widget.auth.authenticateWithBiometrics();
|
||||||
|
if (!mounted) return;
|
||||||
|
if (ok) {
|
||||||
|
final email = await widget.auth.getEmail() ?? '';
|
||||||
|
_goToDashboard(email);
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
_bioMsg = 'Sidik jari gagal: ${err ?? "dibatalkan"}';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// On open: if a valid session is present, go straight to Dashboard.
|
/// On open: if a valid session is present, go straight to Dashboard.
|
||||||
Future<void> _trySilentAuth() async {
|
Future<void> _trySilentAuth() async {
|
||||||
final timeout = await widget.auth.getTimeoutMinutes();
|
final timeout = await widget.auth.getTimeoutMinutes();
|
||||||
@@ -173,10 +189,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
|||||||
_biometricAvailable &&
|
_biometricAvailable &&
|
||||||
_biometricEnabled)
|
_biometricEnabled)
|
||||||
TextButton.icon(
|
TextButton.icon(
|
||||||
onPressed: () {
|
onPressed: _retryBiometric,
|
||||||
setState(() => _bioMsg = null);
|
|
||||||
_promptBiometricOnOpen();
|
|
||||||
},
|
|
||||||
icon: const Icon(Icons.fingerprint),
|
icon: const Icon(Icons.fingerprint),
|
||||||
label: const Text('Gunakan Sidik Jari'),
|
label: const Text('Gunakan Sidik Jari'),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -61,9 +61,15 @@ class AuthService {
|
|||||||
// device credentials (PIN/pattern) so the user isn't hard-blocked.
|
// device credentials (PIN/pattern) so the user isn't hard-blocked.
|
||||||
for (final opt in [
|
for (final opt in [
|
||||||
const AuthenticationOptions(
|
const AuthenticationOptions(
|
||||||
biometricOnly: true, stickyAuth: true, sensitiveTransaction: true),
|
biometricOnly: true,
|
||||||
|
stickyAuth: true,
|
||||||
|
sensitiveTransaction: false,
|
||||||
|
useErrorDialogs: true),
|
||||||
const AuthenticationOptions(
|
const AuthenticationOptions(
|
||||||
biometricOnly: false, stickyAuth: true, sensitiveTransaction: true),
|
biometricOnly: false,
|
||||||
|
stickyAuth: true,
|
||||||
|
sensitiveTransaction: false,
|
||||||
|
useErrorDialogs: true),
|
||||||
]) {
|
]) {
|
||||||
try {
|
try {
|
||||||
final ok = await _localAuth.authenticate(
|
final ok = await _localAuth.authenticate(
|
||||||
|
|||||||
Reference in New Issue
Block a user