mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-01 17:55:11 +00:00
fix: blank password take 2
This commit is contained in:
parent
f06aaef256
commit
f5faf6f49b
3 changed files with 23 additions and 18 deletions
|
@ -1,6 +1,7 @@
|
||||||
|
import * as MODALS from 'constants/modal_types';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectDaemonVersionMatched, selectModal } from 'redux/selectors/app';
|
import { selectDaemonVersionMatched, selectModal } from 'redux/selectors/app';
|
||||||
import { doCheckDaemonVersion, doNotifyUnlockWallet, doHideModal } from 'redux/actions/app';
|
import { doCheckDaemonVersion, doOpenModal, doHideModal } from 'redux/actions/app';
|
||||||
import { doSetClientSetting } from 'redux/actions/settings';
|
import { doSetClientSetting } from 'redux/actions/settings';
|
||||||
import * as settings from 'constants/settings';
|
import * as settings from 'constants/settings';
|
||||||
import SplashScreen from './view';
|
import SplashScreen from './view';
|
||||||
|
@ -15,7 +16,8 @@ const select = state => ({
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
checkDaemonVersion: () => dispatch(doCheckDaemonVersion()),
|
checkDaemonVersion: () => dispatch(doCheckDaemonVersion()),
|
||||||
notifyUnlockWallet: () => dispatch(doNotifyUnlockWallet()),
|
notifyUnlockWallet: shouldTryWithBlankPassword =>
|
||||||
|
dispatch(doOpenModal(MODALS.WALLET_UNLOCK, { shouldTryWithBlankPassword })),
|
||||||
hideModal: () => dispatch(doHideModal()),
|
hideModal: () => dispatch(doHideModal()),
|
||||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,7 +14,7 @@ const FORTY_FIVE_SECONDS = 45 * 1000;
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
checkDaemonVersion: () => Promise<any>,
|
checkDaemonVersion: () => Promise<any>,
|
||||||
notifyUnlockWallet: () => Promise<any>,
|
notifyUnlockWallet: (?boolean) => Promise<any>,
|
||||||
daemonVersionMatched: boolean,
|
daemonVersionMatched: boolean,
|
||||||
onReadyToLaunch: () => void,
|
onReadyToLaunch: () => void,
|
||||||
authenticate: () => void,
|
authenticate: () => void,
|
||||||
|
@ -102,10 +102,14 @@ export default class SplashScreen extends React.PureComponent<Props, State> {
|
||||||
Lbry.status().then(status => {
|
Lbry.status().then(status => {
|
||||||
if (status.is_running) {
|
if (status.is_running) {
|
||||||
Lbry.wallet_status().then(walletStatus => {
|
Lbry.wallet_status().then(walletStatus => {
|
||||||
// Fix wallet bug and reset encryption status
|
// Fix blank password bug related to synced Android users and reset encryption status
|
||||||
if (walletStatus.is_encrypted && walletStatus.is_locked === false) {
|
// Remove this on 12/21/2019 to make sure we don't accidentilly decrypt any wallets
|
||||||
this.setState({ launchedModal: true }, () => notifyUnlockWallet());
|
// This could happen if SDK is already running and app is started.
|
||||||
this.updateStatusCallback(status, true);
|
// This may be patched in a future SDK to support lbry.tv
|
||||||
|
// https://github.com/lbryio/lbry-sdk/issues/2576
|
||||||
|
if (walletStatus.is_encrypted && walletStatus.is_locked === false && launchedModal === false) {
|
||||||
|
this.setState({ launchedModal: true }, () => notifyUnlockWallet(true));
|
||||||
|
this.updateStatusCallback(status);
|
||||||
} else if (walletStatus.is_locked) {
|
} else if (walletStatus.is_locked) {
|
||||||
// Clear the error timeout, it might sit on this step for a while until someone enters their password
|
// Clear the error timeout, it might sit on this step for a while until someone enters their password
|
||||||
if (this.timeout) {
|
if (this.timeout) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ type Props = {
|
||||||
closeModal: () => void,
|
closeModal: () => void,
|
||||||
unlockWallet: (?string) => void,
|
unlockWallet: (?string) => void,
|
||||||
walletUnlockSucceded: boolean,
|
walletUnlockSucceded: boolean,
|
||||||
|
shouldTryWithBlankPassword: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
@ -24,18 +25,16 @@ class ModalWalletUnlock extends React.PureComponent<Props, State> {
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { unlockWallet } = this.props;
|
const { unlockWallet, shouldTryWithBlankPassword } = this.props;
|
||||||
|
|
||||||
getSavedPassword()
|
getSavedPassword().then(p => {
|
||||||
.then(p => {
|
if (p !== null) {
|
||||||
if (p !== null) {
|
this.setState({ password: p, rememberPassword: true });
|
||||||
this.setState({ password: p, rememberPassword: true });
|
unlockWallet(p);
|
||||||
unlockWallet(p);
|
} else if (shouldTryWithBlankPassword) {
|
||||||
} else {
|
unlockWallet('');
|
||||||
unlockWallet('');
|
}
|
||||||
}
|
});
|
||||||
})
|
|
||||||
.catch();
|
|
||||||
}
|
}
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
const { props } = this;
|
const { props } = this;
|
||||||
|
|
Loading…
Add table
Reference in a new issue