Commit 4efbff3e by Nguyễn Thị Thúy

fix bug fingerprint

parent 534162d9
...@@ -35,6 +35,7 @@ import KeychainService from '../../services/keychainService'; ...@@ -35,6 +35,7 @@ import KeychainService from '../../services/keychainService';
import * as Keychain from 'react-native-keychain'; import * as Keychain from 'react-native-keychain';
import EntypoIcon from 'react-native-vector-icons/Entypo'; import EntypoIcon from 'react-native-vector-icons/Entypo';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import DeviceInfo from 'react-native-device-info';
const Login = (props) => { const Login = (props) => {
const {navigation} = props; const {navigation} = props;
...@@ -86,8 +87,12 @@ const Login = (props) => { ...@@ -86,8 +87,12 @@ const Login = (props) => {
}; };
const getCredentialInfo = async () => { const getCredentialInfo = async () => {
try { try {
const appBundleId = await DeviceInfo.getBundleId(); // only used for android as default for service on iOS is bundleId
// Retrieve the credentials // Retrieve the credentials
const options = { const options = {
service: Platform.OS === 'ios' ? undefined : appBundleId,
forceAuth: true,
authenticationPrompt: { authenticationPrompt: {
title: 'Authentication needed', title: 'Authentication needed',
cancel: 'Cancel', cancel: 'Cancel',
......
...@@ -15,6 +15,8 @@ import {showLoading, hideLoading} from '../../actions/loadingAction'; ...@@ -15,6 +15,8 @@ import {showLoading, hideLoading} from '../../actions/loadingAction';
import {verifyPassword} from '../../apis/Functions/users'; import {verifyPassword} from '../../apis/Functions/users';
import {showAlert, TYPE} from '../../components/DropdownAlert'; import {showAlert, TYPE} from '../../components/DropdownAlert';
import TouchID from 'react-native-touch-id' import TouchID from 'react-native-touch-id'
import DeviceInfo from 'react-native-device-info';
const dataLanguage = [ const dataLanguage = [
...@@ -81,8 +83,11 @@ const SettingView = (props) => { ...@@ -81,8 +83,11 @@ const SettingView = (props) => {
}); });
if (res.status == 200 && res.data) { if (res.status == 200 && res.data) {
if (res.data.code == 200) { if (res.data.code == 200) {
const appBundleId = await DeviceInfo.getBundleId(); // only used for android as default for service on iOS is bundleId
await Keychain.setGenericPassword(props.user.email, pass, { await Keychain.setGenericPassword(props.user.email, pass, {
service: Platform.OS === 'ios' ? undefined : appBundleId,
accessControl: Keychain.ACCESS_CONTROL.BIOMETRY_CURRENT_SET, accessControl: Keychain.ACCESS_CONTROL.BIOMETRY_CURRENT_SET,
accessible: Keychain.ACCESSIBLE.WHEN_UNLOCKED_THIS_DEVICE_ONLY,
}); });
AsyncStorage.setItem(KEY.IS_LOGIN_BY_BIOMETRY, JSON.stringify({isLoginByBiometry : true})); AsyncStorage.setItem(KEY.IS_LOGIN_BY_BIOMETRY, JSON.stringify({isLoginByBiometry : true}));
setIsEnabled(true); setIsEnabled(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment