Skip to content

Commit

Permalink
Merge pull request #22202 from Pujan92/fix/21568
Browse files Browse the repository at this point in the history
Fix: 2FA "Disable Authentication" page comes up again if we navigate back to the page in Offline mode
  • Loading branch information
chiragsalian authored Jul 6, 2023
2 parents 11f613a + 3236d35 commit 8def859
Showing 1 changed file with 39 additions and 36 deletions.
75 changes: 39 additions & 36 deletions src/pages/settings/Security/TwoFactorAuth/IsEnabledPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as Expensicons from '../../../../components/Icon/Expensicons';
import themeColors from '../../../../styles/themes/default';
import styles from '../../../../styles/styles';
import ConfirmModal from '../../../../components/ConfirmModal';
import FullPageOfflineBlockingView from '../../../../components/BlockingViews/FullPageOfflineBlockingView';

const defaultProps = {};

Expand All @@ -23,43 +24,45 @@ function IsEnabledPage(props) {
title={props.translate('twoFactorAuth.headerTitle')}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_SECURITY)}
/>
<ScrollView>
<Section
title={props.translate('twoFactorAuth.twoFactorAuthEnabled')}
icon={Illustrations.ShieldYellow}
menuItems={[
{
title: props.translate('twoFactorAuth.disableTwoFactorAuth'),
onPress: () => {
setIsConfirmModalVisible(true);
<FullPageOfflineBlockingView>
<ScrollView>
<Section
title={props.translate('twoFactorAuth.twoFactorAuthEnabled')}
icon={Illustrations.ShieldYellow}
menuItems={[
{
title: props.translate('twoFactorAuth.disableTwoFactorAuth'),
onPress: () => {
setIsConfirmModalVisible(true);
},
icon: Expensicons.Close,
iconFill: themeColors.danger,
wrapperStyle: [styles.cardMenuItem],
},
icon: Expensicons.Close,
iconFill: themeColors.danger,
wrapperStyle: [styles.cardMenuItem],
},
]}
containerStyles={[styles.twoFactorAuthSection]}
>
<View style={styles.mv3}>
<Text style={styles.textLabel}>{props.translate('twoFactorAuth.whatIsTwoFactorAuth')}</Text>
</View>
</Section>
<ConfirmModal
title={props.translate('twoFactorAuth.disableTwoFactorAuth')}
onConfirm={() => {
setIsConfirmModalVisible(false);
Navigation.navigate(ROUTES.SETTINGS_2FA_DISABLE);
}}
onCancel={() => setIsConfirmModalVisible(false)}
onModalHide={() => setIsConfirmModalVisible(false)}
isVisible={isConfirmModalVisible}
prompt={props.translate('twoFactorAuth.disableTwoFactorAuthConfirmation')}
confirmText={props.translate('twoFactorAuth.disable')}
cancelText={props.translate('common.cancel')}
shouldShowCancelButton
danger
/>
</ScrollView>
]}
containerStyles={[styles.twoFactorAuthSection]}
>
<View style={styles.mv3}>
<Text style={styles.textLabel}>{props.translate('twoFactorAuth.whatIsTwoFactorAuth')}</Text>
</View>
</Section>
<ConfirmModal
title={props.translate('twoFactorAuth.disableTwoFactorAuth')}
onConfirm={() => {
setIsConfirmModalVisible(false);
Navigation.navigate(ROUTES.SETTINGS_2FA_DISABLE);
}}
onCancel={() => setIsConfirmModalVisible(false)}
onModalHide={() => setIsConfirmModalVisible(false)}
isVisible={isConfirmModalVisible}
prompt={props.translate('twoFactorAuth.disableTwoFactorAuthConfirmation')}
confirmText={props.translate('twoFactorAuth.disable')}
cancelText={props.translate('common.cancel')}
shouldShowCancelButton
danger
/>
</ScrollView>
</FullPageOfflineBlockingView>
</ScreenWrapper>
);
}
Expand Down

0 comments on commit 8def859

Please sign in to comment.