Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: 2FA "Disable Authentication" page comes up again if we navigate back to the page in Offline mode #22202

Merged
merged 1 commit into from
Jul 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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