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

Remove password field from personal bank account flow #12175

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 1 addition & 3 deletions src/libs/actions/BankAccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,9 @@ function connectBankAccountWithPlaid(bankAccountID, selectedPlaidBankAccount) {
* Adds a bank account via Plaid
*
* @param {Object} account
* @param {String} password
* @TODO offline pattern for this command will have to be added later once the pattern B design doc is complete
*/
function addPersonalBankAccount(account, password) {
function addPersonalBankAccount(account) {
const commandName = 'AddPersonalBankAccount';

const parameters = {
Expand All @@ -130,7 +129,6 @@ function addPersonalBankAccount(account, password) {
bank: account.bankName,
plaidAccountID: account.plaidAccountID,
plaidAccessToken: account.plaidAccessToken,
password,
};

const onyxData = {
Expand Down
33 changes: 4 additions & 29 deletions src/pages/AddPersonalBankAccountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import defaultTheme from '../styles/themes/default';
import Button from '../components/Button';
import FixedFooter from '../components/FixedFooter';
import Form from '../components/Form';
import TextInput from '../components/TextInput';
import canFocusInputOnScreenFocus from '../libs/canFocusInputOnScreenFocus/index.native';
import ROUTES from '../ROUTES';

const propTypes = {
Expand Down Expand Up @@ -70,30 +68,18 @@ class AddPersonalBankAccountPage extends React.Component {
}

/**
* @param {Object} values - form input values passed by the Form component
* @param {Object} values.password The password of the user adding the bank account, for security.
* @returns {Object}
*/
validate(values) {
const errors = {};

if (_.isEmpty(values.password)) {
errors.password = `${this.props.translate('common.password')} ${this.props.translate('common.isRequiredField')}.`;
}

return errors;
validate() {
return {};
}

/**
* @param {Object} values - form input values passed by the Form component
* @param {Object} values.password The password of the user adding the bank account, for security.
*/
submit(values) {
submit() {
const selectedPlaidBankAccount = _.findWhere(lodashGet(this.props.plaidData, 'bankAccounts', []), {
plaidAccountID: this.state.selectedPlaidAccountID,
});

BankAccounts.addPersonalBankAccount(selectedPlaidBankAccount, values.password);
BankAccounts.addPersonalBankAccount(selectedPlaidBankAccount);
}

render() {
Expand Down Expand Up @@ -153,17 +139,6 @@ class AddPersonalBankAccountPage extends React.Component {
receivedRedirectURI={getPlaidOAuthReceivedRedirectURI()}
selectedPlaidAccountID={this.state.selectedPlaidAccountID}
/>
{Boolean(this.state.selectedPlaidAccountID) && (
<TextInput
inputID="password"
label={this.props.translate('addPersonalBankAccountPage.enterPassword')}
secureTextEntry
autoCompleteType="password"
textContentType="password"
autoCapitalize="none"
autoFocus={canFocusInputOnScreenFocus()}
/>
)}
</>
</Form>
)}
Expand Down