allow blank passwords (#575)

This commit is contained in:
Akinwale Ariwodola 2019-06-08 22:17:27 +01:00 committed by GitHub
parent 044947d4ae
commit d3f4abc50e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 18 deletions

View file

@ -149,10 +149,6 @@ class FirstRunScreen extends React.PureComponent {
const { notify, user, hasSyncedWallet } = this.props;
const pageIndex = FirstRunScreen.pages.indexOf(this.state.currentPage);
if (Constants.FIRST_RUN_PAGE_WALLET === this.state.currentPage) {
if (!this.state.walletPassword || this.state.walletPassword.trim().length === 0) {
return notify({ message: 'Please enter a wallet password' });
}
// do apply sync to check if the password is valid
if (hasSyncedWallet) {
this.checkWalletPassword();
@ -263,15 +259,14 @@ class FirstRunScreen extends React.PureComponent {
setFreshPassword = () => {
const { getSync, setClientSetting } = this.props;
if (NativeModules.UtilityModule) {
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.walletPassword);
Lbry.account_encrypt({ new_password: this.state.walletPassword }).then(() => {
Lbry.account_unlock({ password: this.state.walletPassword }).then(() => {
const newPassword = this.state.walletPassword ? this.state.walletPassword : '';
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, newPassword);
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
// fresh account, new password set
getSync(this.state.walletPassword);
getSync(newPassword);
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
this.closeFinalPage();
});
});
}
}

View file

@ -53,13 +53,12 @@ class SyncVerifyPage extends React.PureComponent {
this.setState({ syncApplyStarted: true }, () => {
if (!hasSyncedWallet) {
// fresh account with no sync
Lbry.account_encrypt({ new_password: this.state.password }).then(() => {
Lbry.account_unlock({ password: this.state.password }).then(() => {
getSync(this.state.password);
const newPassword = this.state.password ? this.state.password : '';
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
getSync(newPassword);
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
navigation.goBack();
});
});
} else {
syncApply(syncHash, syncData, this.state.password);
}