From a9bda9ff9cdc52a17eb120b4c54712d55562843d Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Mon, 9 Dec 2024 18:05:21 +0300 Subject: [PATCH 1/5] implemented showing confirm modal on disabling 2FA --- src/languages/en.ts | 2 ++ src/languages/es.ts | 2 ++ src/libs/PolicyUtils.ts | 9 +++++++ .../TwoFactorAuth/Steps/EnabledStep.tsx | 27 +++++++++++++++++-- 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 26f7875e53ee..22404e657956 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1317,6 +1317,8 @@ const translations = { pleaseEnableTwoFactorAuth: 'Please enable two-factor authentication.', twoFactorAuthIsRequiredDescription: 'Two-factor authentication is required for connecting to Xero. Please enable two-factor authentication to continue.', twoFactorAuthIsRequiredForAdminsDescription: 'Two-factor authentication is required for Xero workspace admins. Please enable two-factor authentication to continue.', + twoFactorAuthCannotDisable: 'Cannot disable 2FA', + twoFactorAuthRequired: 'Two-factor authentication (2FA) is required for your Xero connection and cannot be disabled.', }, recoveryCodeForm: { error: { diff --git a/src/languages/es.ts b/src/languages/es.ts index 2be618953135..a34c338aadc8 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1318,6 +1318,8 @@ const translations = { twoFactorAuthIsRequiredDescription: 'La autenticación de dos factores es necesaria para conectarse a Xero. Activa la autenticación de dos factores para continuar.', twoFactorAuthIsRequiredForAdminsDescription: 'La autenticación de dos factores es necesaria para los administradores del área de trabajo de Xero. Activa la autenticación de dos factores para continuar.', + twoFactorAuthCannotDisable: 'No se puede desactivar la autenticación de dos factores (2FA)', + twoFactorAuthRequired: 'La autenticación de dos factores (2FA) es obligatoria para tu conexión a Xero y no se puede desactivar.', }, recoveryCodeForm: { error: { diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index f6b277d69d6b..5f68dbe6f800 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -640,6 +640,14 @@ function getActiveAdminWorkspaces(policies: OnyxCollection | null, curre return activePolicies.filter((policy) => shouldShowPolicy(policy, NetworkStore.isOffline(), currentUserLogin) && isPolicyAdmin(policy, currentUserLogin)); } +/** + * + * Checks whether the current user has a policy with Xero connections + */ +function hasXeroConnection(currentUserLogin: string | undefined) { + return getActiveAdminWorkspaces(allPolicies, currentUserLogin)?.some((policy) => !!policy?.connections?.[CONST.POLICY.CONNECTIONS.NAME.XERO]); +} + /** Whether the user can send invoice from the workspace */ function canSendInvoiceFromWorkspace(policyID: string | undefined): boolean { const policy = getPolicy(policyID); @@ -1201,6 +1209,7 @@ export { findSelectedInvoiceItemWithDefaultSelect, findSelectedTaxAccountWithDefaultSelect, findSelectedSageVendorWithDefaultSelect, + hasXeroConnection, getNetSuiteVendorOptions, canUseTaxNetSuite, canUseProvincialTaxNetSuite, diff --git a/src/pages/settings/Security/TwoFactorAuth/Steps/EnabledStep.tsx b/src/pages/settings/Security/TwoFactorAuth/Steps/EnabledStep.tsx index f887e700adb0..b4f3e3a4e2c1 100644 --- a/src/pages/settings/Security/TwoFactorAuth/Steps/EnabledStep.tsx +++ b/src/pages/settings/Security/TwoFactorAuth/Steps/EnabledStep.tsx @@ -1,5 +1,7 @@ -import React from 'react'; +import React, {useCallback, useState} from 'react'; import {View} from 'react-native'; +import {useOnyx} from 'react-native-onyx'; +import ConfirmModal from '@components/ConfirmModal'; import * as Expensicons from '@components/Icon/Expensicons'; import * as Illustrations from '@components/Icon/Illustrations'; import ScrollView from '@components/ScrollView'; @@ -8,18 +10,25 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; +import {hasXeroConnection} from '@libs/PolicyUtils'; import StepWrapper from '@pages/settings/Security/TwoFactorAuth/StepWrapper/StepWrapper'; import useTwoFactorAuthContext from '@pages/settings/Security/TwoFactorAuth/TwoFactorAuthContext/useTwoFactorAuth'; import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; function EnabledStep() { const theme = useTheme(); const styles = useThemeStyles(); - + const [isVisible, setIsVisible] = useState(false); const {setStep} = useTwoFactorAuthContext(); + const [currentUserLogin] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email}); const {translate} = useLocalize(); + const closeModal = useCallback(() => { + setIsVisible(false); + }, []); + return ( @@ -30,6 +39,10 @@ function EnabledStep() { { title: translate('twoFactorAuth.disableTwoFactorAuth'), onPress: () => { + if (hasXeroConnection(currentUserLogin)) { + setIsVisible(true); + return; + } setStep(CONST.TWO_FACTOR_AUTH_STEPS.GETCODE); }, icon: Expensicons.Close, @@ -43,6 +56,16 @@ function EnabledStep() { {translate('twoFactorAuth.whatIsTwoFactorAuth')} + ); From 189ec2f97384bc12fee6b9056e827f5229498f40 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 14 Jan 2025 15:20:50 +0300 Subject: [PATCH 2/5] update comment --- src/libs/PolicyUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 26df3c36d39b..01f494bb39d3 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -673,7 +673,7 @@ function getActiveAdminWorkspaces(policies: OnyxCollection | null, curre /** * - * Checks whether the current user has a policy with Xero connections + * Checks whether the current user has a policy with Xero accounting software integration */ function hasXeroConnection(currentUserLogin: string | undefined) { return getActiveAdminWorkspaces(allPolicies, currentUserLogin)?.some((policy) => !!policy?.connections?.[CONST.POLICY.CONNECTIONS.NAME.XERO]); From 079e0b7efd458d8b31d4487a00e17db83ae5ba93 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 14 Jan 2025 15:27:51 +0300 Subject: [PATCH 3/5] lint fix --- src/pages/NewChatPage.tsx | 51 +++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index bcf0c917e80b..12814499cca4 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -25,13 +25,22 @@ import useSafeAreaInsets from '@hooks/useSafeAreaInsets'; import useScreenWrapperTranstionStatus from '@hooks/useScreenWrapperTransitionStatus'; import useStyledSafeAreaInsets from '@hooks/useStyledSafeAreaInsets'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; +import {navigateToAndOpenReport, searchInServer, setGroupDraft} from '@libs/actions/Report'; +import {canUseTouchScreen} from '@libs/DeviceCapabilities'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; -import * as OptionsListUtils from '@libs/OptionsListUtils'; +import type {Option, Section} from '@libs/OptionsListUtils'; +import { + filterAndOrderOptions, + formatSectionsFromSearchTerm, + getFirstKeyForList, + getHeaderMessage, + getPersonalDetailSearchTerms, + getUserToInviteOption, + getValidOptions, +} from '@libs/OptionsListUtils'; import type {OptionData} from '@libs/ReportUtils'; import variables from '@styles/variables'; -import * as Report from '@userActions/Report'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; @@ -51,7 +60,7 @@ function useOptions() { }); const defaultOptions = useMemo(() => { - const filteredOptions = OptionsListUtils.getValidOptions( + const filteredOptions = getValidOptions( { reports: listOptions.reports ?? [], personalDetails: listOptions.personalDetails ?? [], @@ -66,7 +75,7 @@ function useOptions() { }, [betas, listOptions.personalDetails, listOptions.reports, selectedOptions]); const options = useMemo(() => { - const filteredOptions = OptionsListUtils.filterAndOrderOptions(defaultOptions, debouncedSearchTerm, { + const filteredOptions = filterAndOrderOptions(defaultOptions, debouncedSearchTerm, { selectedOptions, maxRecentReportsToShow: CONST.IOU.MAX_RECENT_REPORTS_TO_SHOW, }); @@ -75,11 +84,11 @@ function useOptions() { }, [debouncedSearchTerm, defaultOptions, selectedOptions]); const cleanSearchTerm = useMemo(() => debouncedSearchTerm.trim().toLowerCase(), [debouncedSearchTerm]); const headerMessage = useMemo(() => { - return OptionsListUtils.getHeaderMessage( + return getHeaderMessage( options.personalDetails.length + options.recentReports.length !== 0, !!options.userToInvite, debouncedSearchTerm.trim(), - selectedOptions.some((participant) => OptionsListUtils.getPersonalDetailSearchTerms(participant).join(' ').toLowerCase?.().includes(cleanSearchTerm)), + selectedOptions.some((participant) => getPersonalDetailSearchTerms(participant).join(' ').toLowerCase?.().includes(cleanSearchTerm)), ); }, [cleanSearchTerm, debouncedSearchTerm, options.personalDetails.length, options.recentReports.length, options.userToInvite, selectedOptions]); @@ -88,7 +97,7 @@ function useOptions() { return; } - Report.searchInServer(debouncedSearchTerm); + searchInServer(debouncedSearchTerm); }, [debouncedSearchTerm]); useEffect(() => { @@ -102,7 +111,7 @@ function useOptions() { } let participantOption: OptionData | undefined | null = listOptions.personalDetails.find((option) => option.accountID === participant.accountID); if (!participantOption) { - participantOption = OptionsListUtils.getUserToInviteOption({ + participantOption = getUserToInviteOption({ searchValue: participant?.login, }); } @@ -146,14 +155,14 @@ function NewChatPage() { useOptions(); const [sections, firstKeyForList] = useMemo(() => { - const sectionsList: OptionsListUtils.Section[] = []; + const sectionsList: Section[] = []; let firstKey = ''; - const formatResults = OptionsListUtils.formatSectionsFromSearchTerm(debouncedSearchTerm, selectedOptions, recentReports, personalDetails); + const formatResults = formatSectionsFromSearchTerm(debouncedSearchTerm, selectedOptions, recentReports, personalDetails); sectionsList.push(formatResults.section); if (!firstKey) { - firstKey = OptionsListUtils.getFirstKeyForList(formatResults.section.data); + firstKey = getFirstKeyForList(formatResults.section.data); } sectionsList.push({ @@ -162,7 +171,7 @@ function NewChatPage() { shouldShow: !isEmpty(recentReports), }); if (!firstKey) { - firstKey = OptionsListUtils.getFirstKeyForList(recentReports); + firstKey = getFirstKeyForList(recentReports); } sectionsList.push({ @@ -171,7 +180,7 @@ function NewChatPage() { shouldShow: !isEmpty(personalDetails), }); if (!firstKey) { - firstKey = OptionsListUtils.getFirstKeyForList(personalDetails); + firstKey = getFirstKeyForList(personalDetails); } if (userToInvite) { @@ -181,7 +190,7 @@ function NewChatPage() { shouldShow: true, }); if (!firstKey) { - firstKey = OptionsListUtils.getFirstKeyForList([userToInvite]); + firstKey = getFirstKeyForList([userToInvite]); } } @@ -193,7 +202,7 @@ function NewChatPage() { * or navigates to the existing chat if one with those participants already exists. */ const createChat = useCallback( - (option?: OptionsListUtils.Option) => { + (option?: Option) => { if (option?.isSelfDM) { Navigation.dismissModal(option.reportID); return; @@ -209,13 +218,13 @@ function NewChatPage() { Log.warn('Tried to create chat with empty login'); return; } - Report.navigateToAndOpenReport([login]); + navigateToAndOpenReport([login]); }, [selectedOptions], ); const itemRightSideComponent = useCallback( - (item: ListItem & OptionsListUtils.Option, isFocused?: boolean) => { + (item: ListItem & Option, isFocused?: boolean) => { if (!!item.isSelfDM || (item.login && excludedGroupEmails.includes(item.login))) { return null; } @@ -280,7 +289,7 @@ function NewChatPage() { accountID: option.accountID ?? CONST.DEFAULT_NUMBER_ID, })); const logins = [...selectedParticipants, {login: personalData.login, accountID: personalData.accountID}]; - Report.setGroupDraft({participants: logins}); + setGroupDraft({participants: logins}); Keyboard.dismiss(); Navigation.navigate(ROUTES.NEW_CHAT_CONFIRM); }, [selectedOptions, personalData]); @@ -327,7 +336,7 @@ function NewChatPage() { // This is because when wrapping whole screen the screen was freezing when changing Tabs. keyboardVerticalOffset={variables.contentHeaderHeight + top + variables.tabSelectorButtonHeight + variables.tabSelectorButtonPadding} > - + ref={selectionListRef} ListItem={UserListItem} sections={areOptionsInitialized ? sections : CONST.EMPTY_ARRAY} @@ -342,7 +351,7 @@ function NewChatPage() { rightHandSideComponent={itemRightSideComponent} footerContent={footerContent} showLoadingPlaceholder={!areOptionsInitialized} - shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} + shouldPreventDefaultFocusOnSelectRow={!canUseTouchScreen()} isLoadingNewOptions={!!isSearchingForReports} initiallyFocusedOptionKey={firstKeyForList} shouldTextInputInterceptSwipe From 721161d885121df3fe445ba374d090f690262dce Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Tue, 14 Jan 2025 15:29:55 +0300 Subject: [PATCH 4/5] Revert "lint fix" This reverts commit 079e0b7efd458d8b31d4487a00e17db83ae5ba93. --- src/pages/NewChatPage.tsx | 51 ++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index 12814499cca4..bcf0c917e80b 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -25,22 +25,13 @@ import useSafeAreaInsets from '@hooks/useSafeAreaInsets'; import useScreenWrapperTranstionStatus from '@hooks/useScreenWrapperTransitionStatus'; import useStyledSafeAreaInsets from '@hooks/useStyledSafeAreaInsets'; import useThemeStyles from '@hooks/useThemeStyles'; -import {navigateToAndOpenReport, searchInServer, setGroupDraft} from '@libs/actions/Report'; -import {canUseTouchScreen} from '@libs/DeviceCapabilities'; +import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; -import type {Option, Section} from '@libs/OptionsListUtils'; -import { - filterAndOrderOptions, - formatSectionsFromSearchTerm, - getFirstKeyForList, - getHeaderMessage, - getPersonalDetailSearchTerms, - getUserToInviteOption, - getValidOptions, -} from '@libs/OptionsListUtils'; +import * as OptionsListUtils from '@libs/OptionsListUtils'; import type {OptionData} from '@libs/ReportUtils'; import variables from '@styles/variables'; +import * as Report from '@userActions/Report'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; @@ -60,7 +51,7 @@ function useOptions() { }); const defaultOptions = useMemo(() => { - const filteredOptions = getValidOptions( + const filteredOptions = OptionsListUtils.getValidOptions( { reports: listOptions.reports ?? [], personalDetails: listOptions.personalDetails ?? [], @@ -75,7 +66,7 @@ function useOptions() { }, [betas, listOptions.personalDetails, listOptions.reports, selectedOptions]); const options = useMemo(() => { - const filteredOptions = filterAndOrderOptions(defaultOptions, debouncedSearchTerm, { + const filteredOptions = OptionsListUtils.filterAndOrderOptions(defaultOptions, debouncedSearchTerm, { selectedOptions, maxRecentReportsToShow: CONST.IOU.MAX_RECENT_REPORTS_TO_SHOW, }); @@ -84,11 +75,11 @@ function useOptions() { }, [debouncedSearchTerm, defaultOptions, selectedOptions]); const cleanSearchTerm = useMemo(() => debouncedSearchTerm.trim().toLowerCase(), [debouncedSearchTerm]); const headerMessage = useMemo(() => { - return getHeaderMessage( + return OptionsListUtils.getHeaderMessage( options.personalDetails.length + options.recentReports.length !== 0, !!options.userToInvite, debouncedSearchTerm.trim(), - selectedOptions.some((participant) => getPersonalDetailSearchTerms(participant).join(' ').toLowerCase?.().includes(cleanSearchTerm)), + selectedOptions.some((participant) => OptionsListUtils.getPersonalDetailSearchTerms(participant).join(' ').toLowerCase?.().includes(cleanSearchTerm)), ); }, [cleanSearchTerm, debouncedSearchTerm, options.personalDetails.length, options.recentReports.length, options.userToInvite, selectedOptions]); @@ -97,7 +88,7 @@ function useOptions() { return; } - searchInServer(debouncedSearchTerm); + Report.searchInServer(debouncedSearchTerm); }, [debouncedSearchTerm]); useEffect(() => { @@ -111,7 +102,7 @@ function useOptions() { } let participantOption: OptionData | undefined | null = listOptions.personalDetails.find((option) => option.accountID === participant.accountID); if (!participantOption) { - participantOption = getUserToInviteOption({ + participantOption = OptionsListUtils.getUserToInviteOption({ searchValue: participant?.login, }); } @@ -155,14 +146,14 @@ function NewChatPage() { useOptions(); const [sections, firstKeyForList] = useMemo(() => { - const sectionsList: Section[] = []; + const sectionsList: OptionsListUtils.Section[] = []; let firstKey = ''; - const formatResults = formatSectionsFromSearchTerm(debouncedSearchTerm, selectedOptions, recentReports, personalDetails); + const formatResults = OptionsListUtils.formatSectionsFromSearchTerm(debouncedSearchTerm, selectedOptions, recentReports, personalDetails); sectionsList.push(formatResults.section); if (!firstKey) { - firstKey = getFirstKeyForList(formatResults.section.data); + firstKey = OptionsListUtils.getFirstKeyForList(formatResults.section.data); } sectionsList.push({ @@ -171,7 +162,7 @@ function NewChatPage() { shouldShow: !isEmpty(recentReports), }); if (!firstKey) { - firstKey = getFirstKeyForList(recentReports); + firstKey = OptionsListUtils.getFirstKeyForList(recentReports); } sectionsList.push({ @@ -180,7 +171,7 @@ function NewChatPage() { shouldShow: !isEmpty(personalDetails), }); if (!firstKey) { - firstKey = getFirstKeyForList(personalDetails); + firstKey = OptionsListUtils.getFirstKeyForList(personalDetails); } if (userToInvite) { @@ -190,7 +181,7 @@ function NewChatPage() { shouldShow: true, }); if (!firstKey) { - firstKey = getFirstKeyForList([userToInvite]); + firstKey = OptionsListUtils.getFirstKeyForList([userToInvite]); } } @@ -202,7 +193,7 @@ function NewChatPage() { * or navigates to the existing chat if one with those participants already exists. */ const createChat = useCallback( - (option?: Option) => { + (option?: OptionsListUtils.Option) => { if (option?.isSelfDM) { Navigation.dismissModal(option.reportID); return; @@ -218,13 +209,13 @@ function NewChatPage() { Log.warn('Tried to create chat with empty login'); return; } - navigateToAndOpenReport([login]); + Report.navigateToAndOpenReport([login]); }, [selectedOptions], ); const itemRightSideComponent = useCallback( - (item: ListItem & Option, isFocused?: boolean) => { + (item: ListItem & OptionsListUtils.Option, isFocused?: boolean) => { if (!!item.isSelfDM || (item.login && excludedGroupEmails.includes(item.login))) { return null; } @@ -289,7 +280,7 @@ function NewChatPage() { accountID: option.accountID ?? CONST.DEFAULT_NUMBER_ID, })); const logins = [...selectedParticipants, {login: personalData.login, accountID: personalData.accountID}]; - setGroupDraft({participants: logins}); + Report.setGroupDraft({participants: logins}); Keyboard.dismiss(); Navigation.navigate(ROUTES.NEW_CHAT_CONFIRM); }, [selectedOptions, personalData]); @@ -336,7 +327,7 @@ function NewChatPage() { // This is because when wrapping whole screen the screen was freezing when changing Tabs. keyboardVerticalOffset={variables.contentHeaderHeight + top + variables.tabSelectorButtonHeight + variables.tabSelectorButtonPadding} > - + ref={selectionListRef} ListItem={UserListItem} sections={areOptionsInitialized ? sections : CONST.EMPTY_ARRAY} @@ -351,7 +342,7 @@ function NewChatPage() { rightHandSideComponent={itemRightSideComponent} footerContent={footerContent} showLoadingPlaceholder={!areOptionsInitialized} - shouldPreventDefaultFocusOnSelectRow={!canUseTouchScreen()} + shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} isLoadingNewOptions={!!isSearchingForReports} initiallyFocusedOptionKey={firstKeyForList} shouldTextInputInterceptSwipe From 83b5d5a7c1d8874edb4038bbe169732f42d68283 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Wed, 22 Jan 2025 02:01:14 +0300 Subject: [PATCH 5/5] update variable name --- src/libs/PolicyUtils.ts | 4 ++-- .../settings/Security/TwoFactorAuth/Steps/EnabledStep.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/PolicyUtils.ts b/src/libs/PolicyUtils.ts index 01f494bb39d3..9ed9a9e5cfbb 100644 --- a/src/libs/PolicyUtils.ts +++ b/src/libs/PolicyUtils.ts @@ -675,7 +675,7 @@ function getActiveAdminWorkspaces(policies: OnyxCollection | null, curre * * Checks whether the current user has a policy with Xero accounting software integration */ -function hasXeroConnection(currentUserLogin: string | undefined) { +function hasPolicyWithXeroConnection(currentUserLogin: string | undefined) { return getActiveAdminWorkspaces(allPolicies, currentUserLogin)?.some((policy) => !!policy?.connections?.[CONST.POLICY.CONNECTIONS.NAME.XERO]); } @@ -1283,7 +1283,7 @@ export { findSelectedInvoiceItemWithDefaultSelect, findSelectedTaxAccountWithDefaultSelect, findSelectedSageVendorWithDefaultSelect, - hasXeroConnection, + hasPolicyWithXeroConnection, getNetSuiteVendorOptions, canUseTaxNetSuite, canUseProvincialTaxNetSuite, diff --git a/src/pages/settings/Security/TwoFactorAuth/Steps/EnabledStep.tsx b/src/pages/settings/Security/TwoFactorAuth/Steps/EnabledStep.tsx index b4f3e3a4e2c1..c11ad6295e5c 100644 --- a/src/pages/settings/Security/TwoFactorAuth/Steps/EnabledStep.tsx +++ b/src/pages/settings/Security/TwoFactorAuth/Steps/EnabledStep.tsx @@ -10,7 +10,7 @@ import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import {hasXeroConnection} from '@libs/PolicyUtils'; +import {hasPolicyWithXeroConnection} from '@libs/PolicyUtils'; import StepWrapper from '@pages/settings/Security/TwoFactorAuth/StepWrapper/StepWrapper'; import useTwoFactorAuthContext from '@pages/settings/Security/TwoFactorAuth/TwoFactorAuthContext/useTwoFactorAuth'; import CONST from '@src/CONST'; @@ -39,7 +39,7 @@ function EnabledStep() { { title: translate('twoFactorAuth.disableTwoFactorAuth'), onPress: () => { - if (hasXeroConnection(currentUserLogin)) { + if (hasPolicyWithXeroConnection(currentUserLogin)) { setIsVisible(true); return; }