Biometric bypass on login: if enabled+registered, prompt fingerprint on open -> on success skip email/password. On fail, show grey msg and allow manual login via Masuk button

This commit is contained in:
cania
2026-08-13 09:59:41 +02:00
parent 3016075574
commit 3d9883d3e4

View File

@@ -20,6 +20,7 @@ class _AuthScreenState extends State<AuthScreen> {
bool _isLogin = true; bool _isLogin = true;
bool _busy = false; bool _busy = false;
String? _error; String? _error;
String? _bioMsg;
@override @override
void initState() { void initState() {
@@ -53,8 +54,12 @@ class _AuthScreenState extends State<AuthScreen> {
if (ok) { if (ok) {
final email = await widget.auth.getEmail() ?? ''; final email = await widget.auth.getEmail() ?? '';
_goToDashboard(email); _goToDashboard(email);
} else {
// fingerprint failed/cancelled -> let user login manually
setState(() {
_bioMsg = 'Gagal verifikasi sidik jari. Silakan masuk manual.';
});
} }
// on failure, the auth screen stays; user can tap Masuk manually
} }
/// On open: if a valid session is present, go straight to Dashboard. /// On open: if a valid session is present, go straight to Dashboard.
@@ -140,6 +145,12 @@ class _AuthScreenState extends State<AuthScreen> {
const SizedBox(height: 8), const SizedBox(height: 8),
if (_error != null) if (_error != null)
Text(_error!, style: const TextStyle(color: Colors.red)), Text(_error!, style: const TextStyle(color: Colors.red)),
if (_bioMsg != null)
Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Text(_bioMsg!,
style: const TextStyle(color: Colors.grey)),
),
const SizedBox(height: 12), const SizedBox(height: 12),
_busy _busy
? const CircularProgressIndicator() ? const CircularProgressIndicator()