empty password handling

This commit is contained in:
Akinwale Ariwodola 2019-09-06 14:40:38 +01:00
parent ad810d5c9e
commit 7a141c817e
4 changed files with 10 additions and 7 deletions

View file

@ -33,7 +33,7 @@ class FirstRunScreen extends React.PureComponent {
isEmailVerified: false,
skipAccountConfirmed: false,
showBottomContainer: false,
walletPassword: null,
walletPassword: '',
syncApplyStarted: false,
};
@ -253,7 +253,7 @@ class FirstRunScreen extends React.PureComponent {
};
onWalletPasswordChanged = password => {
this.setState({ walletPassword: password });
this.setState({ walletPassword: password !== null ? password : '' });
};
onWalletViewLayout = () => {

View file

@ -166,14 +166,14 @@ class SplashScreen extends React.PureComponent {
// For now, automatically unlock the wallet if a password is set so that downloads work
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => {
if (password && password.trim().length > 0) {
if (password) {
this.setState({
message: 'Unlocking account',
details: 'Decrypting wallet',
});
// unlock the wallet and then finish the splash screen
Lbry.account_unlock({ password })
Lbry.account_unlock({ password: password || '' })
.then(() => {
this.setState({
message: testingNetwork,

View file

@ -5,7 +5,7 @@ import { BarPasswordStrengthDisplay } from 'react-native-password-strength-meter
import Button from 'component/button';
import Link from 'component/link';
import Colors from 'styles/colors';
import Constants from 'constants';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import firstRunStyle from 'styles/firstRun';
import Icon from 'react-native-vector-icons/FontAwesome5';
import rewardStyle from 'styles/reward';
@ -62,7 +62,10 @@ class SyncVerifyPage extends React.PureComponent {
} else {
// password successfully verified
if (NativeModules.UtilityModule) {
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.password);
NativeModules.UtilityModule.setSecureValue(
Constants.KEY_FIRST_RUN_PASSWORD,
this.state.password ? this.state.password : ''
);
}
setDefaultAccount();
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);

View file

@ -47,7 +47,7 @@ class WalletPage extends React.PureComponent {
const { deviceWalletSynced, getSync, user } = this.props;
if (deviceWalletSynced && user && user.has_verified_email) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
if (walletPassword && walletPassword.trim().length > 0) {
if (walletPassword) {
getSync(walletPassword);
}
});