-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Display banner to enable 2FA when setting up VBBA #12424
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1caa160
Add a new component to display banner
MonilBhavsar 686d711
Update copy
MonilBhavsar 8e4d306
Add new assets
MonilBhavsar 20d9506
Display banner conditionally
MonilBhavsar 55d60d5
Merge branch 'main' into monil-VBA2FASetup
MonilBhavsar 534d276
Fix some styles
MonilBhavsar 8a17d45
Fix Lint warning
MonilBhavsar d3fddcd
Merge branch 'main' into monil-VBA2FASetup
MonilBhavsar 1f96747
Use new styling
MonilBhavsar cd6f2a9
Use new icon
MonilBhavsar d38d5c9
Update copy
MonilBhavsar 57ed7a5
Address review
MonilBhavsar 6f0f78c
Merge branch 'main' into monil-VBA2FASetup
MonilBhavsar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
assets/images/simple-illustrations/simple-illustration__shield.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import Text from '../../components/Text'; | ||
import styles from '../../styles/styles'; | ||
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; | ||
import * as Expensicons from '../../components/Icon/Expensicons'; | ||
import * as Illustrations from '../../components/Icon/Illustrations'; | ||
import Section from '../../components/Section'; | ||
import * as Link from '../../libs/actions/Link'; | ||
import CONFIG from '../../CONFIG'; | ||
import ROUTES from '../../ROUTES'; | ||
import themeColors from '../../styles/themes/default'; | ||
|
||
const propTypes = { | ||
...withLocalizePropTypes, | ||
}; | ||
const Enable2FAPrompt = props => ( | ||
<Section | ||
title={props.translate('validationStep.enable2FATitle')} | ||
icon={Illustrations.ShieldYellow} | ||
menuItems={[ | ||
{ | ||
title: props.translate('validationStep.secureYourAccount'), | ||
onPress: () => { | ||
Link.openOldDotLink(`settings?param={"section":"account","action":"enableTwoFactorAuth","exitTo":"${CONFIG.EXPENSIFY.NEW_EXPENSIFY_URL}${ROUTES.BANK_ACCOUNT}"}`); | ||
}, | ||
icon: Expensicons.Shield, | ||
shouldShowRightIcon: true, | ||
iconRight: Expensicons.NewWindow, | ||
iconFill: themeColors.success, | ||
wrapperStyle: [styles.cardMenuItem], | ||
}, | ||
]} | ||
> | ||
<View style={[styles.mv3]}> | ||
<Text> | ||
{props.translate('validationStep.enable2FAText')} | ||
</Text> | ||
</View> | ||
</Section> | ||
); | ||
|
||
Enable2FAPrompt.propTypes = propTypes; | ||
Enable2FAPrompt.displayName = 'Enable2FAPrompt'; | ||
|
||
export default withLocalize(Enable2FAPrompt); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import lodashGet from 'lodash/get'; | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import {ScrollView, View} from 'react-native'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import Str from 'expensify-common/lib/str'; | ||
import _ from 'underscore'; | ||
import PropTypes from 'prop-types'; | ||
import styles from '../../styles/styles'; | ||
import themeColors from '../../styles/themes/default'; | ||
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; | ||
|
@@ -27,12 +28,20 @@ import Section from '../../components/Section'; | |
import CONST from '../../CONST'; | ||
import Button from '../../components/Button'; | ||
import MenuItem from '../../components/MenuItem'; | ||
import Enable2FAPrompt from './Enable2FAPrompt'; | ||
|
||
const propTypes = { | ||
...withLocalizePropTypes, | ||
|
||
/** Bank account currently in setup */ | ||
reimbursementAccount: reimbursementAccountPropTypes, | ||
|
||
/** User's account who is setting up bank account */ | ||
account: PropTypes.shape({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The guidelines mention: "All props are defined accurately and each prop has a /** comment above it */" |
||
|
||
/** If user has Two factor authentication enabled */ | ||
requiresTwoFactorAuth: PropTypes.bool, | ||
}), | ||
}; | ||
|
||
const defaultProps = { | ||
|
@@ -41,6 +50,9 @@ const defaultProps = { | |
errors: {}, | ||
maxAttemptsReached: false, | ||
}, | ||
account: { | ||
requiresTwoFactorAuth: false, | ||
}, | ||
}; | ||
|
||
class ValidationStep extends React.Component { | ||
|
@@ -117,6 +129,7 @@ class ValidationStep extends React.Component { | |
|
||
const maxAttemptsReached = lodashGet(this.props, 'reimbursementAccount.maxAttemptsReached'); | ||
const isVerifying = !maxAttemptsReached && state === BankAccount.STATE.VERIFYING; | ||
const requiresTwoFactorAuth = lodashGet(this.props, 'account.requiresTwoFactorAuth'); | ||
|
||
return ( | ||
<View style={[styles.flex1, styles.justifyContentBetween]}> | ||
|
@@ -160,7 +173,7 @@ class ValidationStep extends React.Component { | |
{this.props.translate('validationStep.descriptionCTA')} | ||
</Text> | ||
</View> | ||
<View style={[styles.mv5, styles.flex1]}> | ||
<View style={[styles.mv5]}> | ||
<TextInput | ||
inputID="amount1" | ||
shouldSaveDraft | ||
|
@@ -183,10 +196,15 @@ class ValidationStep extends React.Component { | |
keyboardType="decimal-pad" | ||
/> | ||
</View> | ||
{!requiresTwoFactorAuth && ( | ||
<View style={[styles.mln5, styles.mrn5]}> | ||
<Enable2FAPrompt /> | ||
</View> | ||
)} | ||
</Form> | ||
)} | ||
{isVerifying && ( | ||
<View style={[styles.flex1]}> | ||
<ScrollView style={[styles.flex1]}> | ||
<Section | ||
title={this.props.translate('workspace.bankAccount.letsFinishInChat')} | ||
icon={Illustrations.ConciergeBubble} | ||
|
@@ -213,7 +231,10 @@ class ValidationStep extends React.Component { | |
wrapperStyle={[styles.cardMenuItem, styles.mv3]} | ||
/> | ||
</Section> | ||
</View> | ||
{!requiresTwoFactorAuth && ( | ||
<Enable2FAPrompt /> | ||
)} | ||
</ScrollView> | ||
)} | ||
</View> | ||
); | ||
|
@@ -229,5 +250,8 @@ export default compose( | |
reimbursementAccount: { | ||
key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, | ||
}, | ||
account: { | ||
key: ONYXKEYS.ACCOUNT, | ||
}, | ||
}), | ||
)(ValidationStep); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Heads-up that this has caused a small visual issue in #20932
This icon wasn't changing color on hover, since we were overriding its color with
iconFill
prop