mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
Verify identity when enabling biometric auth
- Prompt for biometric authentication before enabling feature - Add error handling for failed authentication - Update .gitignore to exclude .opencode directory
This commit is contained in:
1 parent
5a7488bd62
commit
d62fd1c053
2 files changed
+21
-2
No files matched your search
@@ -54,3 +54,6 @@ coverage/
|
|||||||
.tmp/
|
.tmp/
|
||||||
*.tmp
|
*.tmp
|
||||||
nul
|
nul
|
||||||
|
|
||||||
|
# Opencode
|
||||||
|
.opencode/
|
||||||
@@ -277,11 +277,27 @@ export function useProfileSettings() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleBiometricToggle = async (value: boolean) => {
|
const handleBiometricToggle = async (value: boolean) => {
|
||||||
setBiometricEnabledState(value);
|
|
||||||
setIsUpdatingBiometric(true);
|
setIsUpdatingBiometric(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await setBiometricEnabled(value);
|
if (value) {
|
||||||
|
const { authenticateWithBiometric } = await import('../../../lib/biometricAuth');
|
||||||
|
const success = await authenticateWithBiometric();
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
Alert.alert(
|
||||||
|
"Authentication Failed",
|
||||||
|
`Could not verify your ${biometricType}. Please try again.`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await setBiometricEnabled(true);
|
||||||
|
setBiometricEnabledState(true);
|
||||||
|
} else {
|
||||||
|
await setBiometricEnabled(false);
|
||||||
|
setBiometricEnabledState(false);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setBiometricEnabledState(!value);
|
setBiometricEnabledState(!value);
|
||||||
Alert.alert("Error", `Failed to ${value ? "enable" : "disable"} ${biometricType}. Please try again.`);
|
Alert.alert("Error", `Failed to ${value ? "enable" : "disable"} ${biometricType}. Please try again.`);
|
||||||
|
|||||||
Reference in new issue
Block a user