allow blank passwords (#575)
This commit is contained in:
parent
044947d4ae
commit
d3f4abc50e
2 changed files with 12 additions and 18 deletions
|
@ -149,10 +149,6 @@ class FirstRunScreen extends React.PureComponent {
|
||||||
const { notify, user, hasSyncedWallet } = this.props;
|
const { notify, user, hasSyncedWallet } = this.props;
|
||||||
const pageIndex = FirstRunScreen.pages.indexOf(this.state.currentPage);
|
const pageIndex = FirstRunScreen.pages.indexOf(this.state.currentPage);
|
||||||
if (Constants.FIRST_RUN_PAGE_WALLET === 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
|
// do apply sync to check if the password is valid
|
||||||
if (hasSyncedWallet) {
|
if (hasSyncedWallet) {
|
||||||
this.checkWalletPassword();
|
this.checkWalletPassword();
|
||||||
|
@ -263,15 +259,14 @@ class FirstRunScreen extends React.PureComponent {
|
||||||
setFreshPassword = () => {
|
setFreshPassword = () => {
|
||||||
const { getSync, setClientSetting } = this.props;
|
const { getSync, setClientSetting } = this.props;
|
||||||
if (NativeModules.UtilityModule) {
|
if (NativeModules.UtilityModule) {
|
||||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.walletPassword);
|
const newPassword = this.state.walletPassword ? this.state.walletPassword : '';
|
||||||
Lbry.account_encrypt({ new_password: this.state.walletPassword }).then(() => {
|
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, newPassword);
|
||||||
Lbry.account_unlock({ password: this.state.walletPassword }).then(() => {
|
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
|
||||||
// fresh account, new password set
|
// fresh account, new password set
|
||||||
getSync(this.state.walletPassword);
|
getSync(newPassword);
|
||||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||||
this.closeFinalPage();
|
this.closeFinalPage();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,13 +53,12 @@ class SyncVerifyPage extends React.PureComponent {
|
||||||
this.setState({ syncApplyStarted: true }, () => {
|
this.setState({ syncApplyStarted: true }, () => {
|
||||||
if (!hasSyncedWallet) {
|
if (!hasSyncedWallet) {
|
||||||
// fresh account with no sync
|
// fresh account with no sync
|
||||||
Lbry.account_encrypt({ new_password: this.state.password }).then(() => {
|
const newPassword = this.state.password ? this.state.password : '';
|
||||||
Lbry.account_unlock({ password: this.state.password }).then(() => {
|
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
|
||||||
getSync(this.state.password);
|
getSync(newPassword);
|
||||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||||
navigation.goBack();
|
navigation.goBack();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
syncApply(syncHash, syncData, this.state.password);
|
syncApply(syncHash, syncData, this.state.password);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue