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

Make sure the recovery phrase is emptied upon process abortion #265

Merged
merged 3 commits into from
Jul 25, 2019
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
12 changes: 8 additions & 4 deletions src/screens/AccountRecover.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'use strict';

import React from 'react';
import { Alert, findNodeHandle, SafeAreaView, StyleSheet, ScrollView, Text, View } from 'react-native';
import { Alert, SafeAreaView, ScrollView, StyleSheet, Text } from 'react-native';
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'
import { Subscribe } from 'unstated';

Expand All @@ -37,6 +37,7 @@ export default class AccountRecover extends React.Component {
title: 'Recover Account',
headerBackTitle: 'Back'
};

render() {
return (
<Subscribe to={[AccountsStore]}>
Expand All @@ -51,6 +52,11 @@ class AccountRecoverView extends React.Component {
super(...args);
}

componentWillUnmount = function () {
// called when the user goes back, or finishes the whole recovery process
this.props.accounts.updateNew({seed : ''});
}

render() {
const { accounts } = this.props;
const selected = accounts.getNew();
Expand Down Expand Up @@ -86,9 +92,7 @@ class AccountRecoverView extends React.Component {
</Text>
<AccountSeed
valid={validateSeed(selected.seed, selected.validBip39Seed).valid}
onChangeText={seed => {
accounts.updateNew({ seed });
}}
onChangeText={seed => accounts.updateNew({ seed })}
value={selected.seed}
/>
<AccountCard
Expand Down