Skip to content

Commit

Permalink
bugfix/delete wallet with random password (#2422)
Browse files Browse the repository at this point in the history
* datenow

* strinh

* checkunlocked

* setLocked

* ok

* p

* gobackfirst

* locale

* mounted
  • Loading branch information
estebanmino authored Mar 22, 2021
1 parent 7cb9212 commit f688a8d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/components/Views/Login/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ class Login extends PureComponent {
const { KeyringController } = Engine.context;
try {
await Engine.resetState();
await KeyringController.createNewVaultAndKeychain('');
await KeyringController.createNewVaultAndKeychain(`${Date.now()}`);
await KeyringController.setLocked();
this.deleteExistingUser();
} catch (error) {
Logger.log(error, `Failed to createNewVaultAndKeychain: ${error}`);
Expand Down
10 changes: 10 additions & 0 deletions app/components/Views/QRScanner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { strings } from '../../../../locales/i18n';
import SharedDeeplinkManager from '../../../core/DeeplinkManager';
import AppConstants from '../../../core/AppConstants';
import { failedSeedPhraseRequirements, isValidMnemonic } from '../../../util/validators';
import Engine from '../../../core/Engine';

const styles = StyleSheet.create({
container: {
Expand Down Expand Up @@ -103,6 +104,15 @@ export default class QrScanner extends PureComponent {
this.props.navigation.goBack();
}
} else {
const { KeyringController } = Engine.context;
const isUnlocked = KeyringController.isUnlocked();

if (!isUnlocked) {
this.props.navigation.goBack();
Alert.alert(strings('qr_scanner.error'), strings('qr_scanner.attempting_to_scan_with_wallet_locked'));
this.mounted = false;
return;
}
// Let ethereum:address go forward
if (content.split('ethereum:').length > 1 && !parse(content).function_name) {
this.shouldReadBarCode = false;
Expand Down
1 change: 1 addition & 0 deletions locales/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@
"ok": "Ok",
"cancel": "Cancel",
"error": "Error",
"attempting_to_scan_with_wallet_locked": "Looks like you're trying to scan a QR code, you need to unlock your wallet to be able to use it.",
"attempting_sync_from_wallet_error": "Looks like you're trying to sync with the extension. In order to do so, you will need to erase your current wallet. \n\nOnce you've erased or reinstalled a fresh version of the app, select the option to \"Sync with MetaMask Extension\". Important! Before erasing your wallet, make sure you've backed up your recovery phrase."
},
"action_view": {
Expand Down

0 comments on commit f688a8d

Please sign in to comment.