Merge pull request #93 from lbryio/fix-password-flow

fix error for auto-login and remove password warning
This commit is contained in:
Akinwale Ariwodola 2019-12-06 16:54:53 +01:00 committed by GitHub
commit 970b53ffdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 26 deletions

View file

@ -146,15 +146,6 @@ class WalletPage extends React.PureComponent {
<Icon name={this.state.revealPassword ? 'eye-slash' : 'eye'} size={16} style={firstRunStyle.revealIcon} />
</TouchableOpacity>
</View>
{(!this.state.password || this.state.password.trim().length === 0) && (
<View style={firstRunStyle.passwordWarning}>
<Text style={firstRunStyle.passwordWarningText}>
{hasSyncedWallet
? __('If you did not provide a password, please press Use LBRY to continue.')
: __('You can proceed without a password, but this is not recommended.')}
</Text>
</View>
)}
{(!hasSyncedWallet && this.state.password && this.state.password.trim().length) > 0 && (
<View style={firstRunStyle.passwordStrength}>

View file

@ -28,6 +28,7 @@ class FirstRunScreen extends React.PureComponent {
emailCollectTracked: false,
emailSubmitted: false,
enterPasswordTracked: false,
autoLoginTried: false,
isFirstRun: false,
launchUrl: null,
languageLoaded: false,
@ -38,7 +39,6 @@ class FirstRunScreen extends React.PureComponent {
walletPassword: '',
syncApplyStarted: false,
syncApplyCompleted: false,
language: null,
};
componentDidMount() {
@ -126,8 +126,16 @@ class FirstRunScreen extends React.PureComponent {
if (this.state.syncApplyStarted && !syncApplyIsPending) {
if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) {
notify({ message: __(syncApplyErrorMessage), isError: true });
this.setState({ showBottomContainer: true, syncApplyStarted: false, syncApplyCompleted: false });
if (this.state.autoLoginTried) {
// don't show the error message for auto-login if it fails
notify({ message: __(syncApplyErrorMessage), isError: true });
}
this.setState({
autoLoginTried: true,
showBottomContainer: true,
syncApplyStarted: false,
syncApplyCompleted: false,
});
} else {
this.setState({ syncApplyCompleted: true });
// password successfully verified

View file

@ -170,7 +170,6 @@ class SplashScreen extends React.PureComponent {
}
_updateStatusCallback(status) {
console.log(status);
const { fetchSubscriptions, getSync, setClientSetting } = this.props;
const startupStatus = status.startup_status;
const walletStatus = status.wallet;
@ -222,7 +221,7 @@ class SplashScreen extends React.PureComponent {
return;
}
const headerSyncProgress = walletStatus.headers_synchronization_progress;
const headerSyncProgress = walletStatus ? walletStatus.headers_synchronization_progress : null;
if (headerSyncProgress && headerSyncProgress < 100) {
this.setState({
isDownloadingHeaders: true,

View file

@ -21,6 +21,7 @@ class SyncVerifyPage extends React.PureComponent {
revealPassword: false,
autoPassword: false,
autoLoginAttempted: false,
autoLoginTried: false,
autoLoginFlow: true,
};
@ -67,8 +68,10 @@ class SyncVerifyPage extends React.PureComponent {
if (this.state.syncApplyStarted && !syncApplyIsPending) {
if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) {
notify({ message: __(syncApplyErrorMessage), isError: true });
this.setState({ syncApplyStarted: false, autoLoginFlow: false });
if (this.state.autoLoginTried) {
notify({ message: __(syncApplyErrorMessage), isError: true });
}
this.setState({ autoLoginTried: true, syncApplyStarted: false, autoLoginFlow: false });
} else {
// password successfully verified
this.setState({ syncApplyCompleted: true });
@ -194,16 +197,6 @@ class SyncVerifyPage extends React.PureComponent {
</TouchableOpacity>
</View>
{(!this.state.password || this.state.password.trim().length === 0) && (
<View style={firstRunStyle.passwordWarning}>
<Text style={firstRunStyle.passwordWarningText}>
{hasSyncedWallet
? __('If you did not provide a password, please press Use LBRY to continue.')
: __('You can proceed without a password, but this is not recommended.')}
</Text>
</View>
)}
{(!hasSyncedWallet && this.state.password && this.state.password.trim().length) > 0 && (
<View style={firstRunStyle.passwordStrength}>
<BarPasswordStrengthDisplay