display sign in instructions for emails that exist (#84)

* display sign in instructions for emails that exist
* lbry.tv account
This commit is contained in:
Akinwale Ariwodola 2019-12-05 19:30:23 +01:00 committed by GitHub
parent fa2de8382a
commit fd715886cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 47 additions and 29 deletions

View file

@ -8,6 +8,7 @@ import {
doUserEmailNew, doUserEmailNew,
doUserResendVerificationEmail, doUserResendVerificationEmail,
selectAuthToken, selectAuthToken,
selectEmailAlreadyExists,
selectEmailNewErrorMessage, selectEmailNewErrorMessage,
selectEmailNewIsPending, selectEmailNewIsPending,
selectEmailToVerify, selectEmailToVerify,
@ -28,6 +29,7 @@ const select = state => ({
authenticating: selectAuthenticationIsPending(state), authenticating: selectAuthenticationIsPending(state),
authToken: selectAuthToken(state), authToken: selectAuthToken(state),
emailToVerify: selectEmailToVerify(state), emailToVerify: selectEmailToVerify(state),
emailAlreadyExists: selectEmailAlreadyExists(state),
emailNewErrorMessage: selectEmailNewErrorMessage(state), emailNewErrorMessage: selectEmailNewErrorMessage(state),
emailNewPending: selectEmailNewIsPending(state), emailNewPending: selectEmailNewIsPending(state),
hasSyncedWallet: selectHasSyncedWallet(state), hasSyncedWallet: selectHasSyncedWallet(state),

View file

@ -64,7 +64,7 @@ class EmailCollectPage extends React.PureComponent {
}} }}
/> />
<Text style={firstRunStyle.paragraph}> <Text style={firstRunStyle.paragraph}>
{__('An account will allow you to earn rewards and keep your account and settings synced.')} {__('A lbry.tv account allows you to earn rewards, backup your wallet, and keep everything in sync.')}
</Text> </Text>
<Text style={firstRunStyle.infoParagraph}> <Text style={firstRunStyle.infoParagraph}>
{__('This information is disclosed only to LBRY, Inc. and not to the LBRY network.')} {__('This information is disclosed only to LBRY, Inc. and not to the LBRY network.')}

View file

@ -17,24 +17,26 @@ class EmailVerifyPage extends React.PureComponent {
}; };
render() { render() {
const { onEmailViewLayout, email } = this.props; const { onEmailViewLayout, email, emailAlreadyExists } = this.props;
const content = ( const content = (
<View onLayout={() => onEmailViewLayout('verify')}> <View onLayout={() => onEmailViewLayout('verify')}>
<Text style={firstRunStyle.title}>Verify Email</Text> <Text style={firstRunStyle.title}>{emailAlreadyExists ? __('Sign In') : __('Verify Email')}</Text>
<Text style={firstRunStyle.paragraph}> <Text style={firstRunStyle.paragraph}>
An email has been sent to{' '} {__('An email has been sent to')}
<Text style={firstRunStyle.nowrap} numberOfLines={1}> {'\n\n'}
{email} {email}
</Text> {'\n\n'}
. Please follow the instructions in the message to verify your email address. {emailAlreadyExists && __('Please click the link in the message to complete signing in')}
{!emailAlreadyExists && __('Please click the link in the message to verify your email address')}.
</Text> </Text>
<View style={firstRunStyle.buttonContainer}> <View style={firstRunStyle.buttonContainer}>
<Button <Button
style={firstRunStyle.verificationButton} style={firstRunStyle.verificationButton}
theme={'light'} theme={'light'}
text={'Resend'} text={__('Resend')}
onPress={this.onResendPressed} onPress={this.onResendPressed}
/> />
</View> </View>

View file

@ -379,6 +379,7 @@ class FirstRunScreen extends React.PureComponent {
authenticating, authenticating,
authToken, authToken,
checkSync, checkSync,
emailAlreadyExists,
emailNewErrorMessage, emailNewErrorMessage,
emailNewPending, emailNewPending,
emailToVerify, emailToVerify,
@ -420,6 +421,7 @@ class FirstRunScreen extends React.PureComponent {
<EmailVerifyPage <EmailVerifyPage
onEmailViewLayout={this.onEmailViewLayout} onEmailViewLayout={this.onEmailViewLayout}
email={this.state.email} email={this.state.email}
emailAlreadyExists={emailAlreadyExists}
notify={notify} notify={notify}
resendVerificationEmail={resendVerificationEmail} resendVerificationEmail={resendVerificationEmail}
/> />

View file

@ -14,6 +14,7 @@ import {
selectPhoneToVerify, selectPhoneToVerify,
selectPhoneVerifyIsPending, selectPhoneVerifyIsPending,
selectPhoneVerifyErrorMessage, selectPhoneVerifyErrorMessage,
selectEmailAlreadyExists,
selectEmailNewErrorMessage, selectEmailNewErrorMessage,
selectEmailNewIsPending, selectEmailNewIsPending,
selectEmailToVerify, selectEmailToVerify,
@ -32,6 +33,7 @@ import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import Verification from './view'; import Verification from './view';
const select = state => ({ const select = state => ({
emailAlreadyExists: selectEmailAlreadyExists(state),
emailToVerify: selectEmailToVerify(state), emailToVerify: selectEmailToVerify(state),
emailNewErrorMessage: selectEmailNewErrorMessage(state), emailNewErrorMessage: selectEmailNewErrorMessage(state),
emailNewPending: selectEmailNewIsPending(state), emailNewPending: selectEmailNewIsPending(state),

View file

@ -105,16 +105,20 @@ class EmailVerifyPage extends React.PureComponent {
}; };
render() { render() {
const { emailNewPending } = this.props; const { emailAlreadyExists, emailNewPending } = this.props;
return ( return (
<View style={firstRunStyle.container}> <View style={firstRunStyle.container}>
<Text style={rewardStyle.verificationTitle}> <Text style={rewardStyle.verificationTitle}>
{Constants.PHASE_COLLECTION === this.state.phase ? __('Email') : __('Verify Email')} {Constants.PHASE_COLLECTION === this.state.phase
? __('Email')
: emailAlreadyExists
? __('Sign In')
: __('Verify Email')}
</Text> </Text>
{Constants.PHASE_COLLECTION === this.state.phase && ( {Constants.PHASE_COLLECTION === this.state.phase && (
<View> <View>
<Text style={firstRunStyle.paragraph}>Please provide an email address.</Text> <Text style={firstRunStyle.paragraph}>{__('Please provide an email address.')}</Text>
<TextInput <TextInput
style={firstRunStyle.emailInput} style={firstRunStyle.emailInput}
placeholder={this.state.placeholder} placeholder={this.state.placeholder}
@ -138,7 +142,7 @@ class EmailVerifyPage extends React.PureComponent {
<Button <Button
style={rewardStyle.verificationButton} style={rewardStyle.verificationButton}
theme={'light'} theme={'light'}
text={__('Send verification email')} text={__('Continue')}
onPress={this.onSendVerificationPressed} onPress={this.onSendVerificationPressed}
/> />
)} )}
@ -154,8 +158,12 @@ class EmailVerifyPage extends React.PureComponent {
{Constants.PHASE_VERIFICATION === this.state.phase && ( {Constants.PHASE_VERIFICATION === this.state.phase && (
<View> <View>
<Text style={firstRunStyle.paragraph}> <Text style={firstRunStyle.paragraph}>
An email has been sent to <Text style={firstRunStyle.nowrap}>{this.state.email}</Text>. Please follow the {__('An email has been sent to')}
instructions in the message to verify your email address. {'\n\n'}
{this.state.email}
{'\n\n'}
{emailAlreadyExists && __('Please click the link in the message to complete signing in.')}
{!emailAlreadyExists && __('Please click the link in the message to verify your email address')}
</Text> </Text>
<View style={rewardStyle.buttonContainer}> <View style={rewardStyle.buttonContainer}>

View file

@ -20,22 +20,22 @@ class ManualVerifyPage extends React.PureComponent {
render() { render() {
return ( return (
<View style={firstRunStyle.container}> <View style={firstRunStyle.container}>
<Text style={rewardStyle.verificationTitle}>Manual Reward Verification</Text> <Text style={rewardStyle.verificationTitle}>{__('Manual Reward Verification')}</Text>
<Text style={firstRunStyle.spacedParagraph}> <Text style={firstRunStyle.spacedParagraph}>
{__( {__(
'This account must undergo review before you can participate in the rewards program. This can take anywhere from several minutes to several days.' 'This account must undergo review before you can participate in the rewards program. This can take anywhere from several minutes to several days.'
)} )}
</Text> </Text>
<Text style={firstRunStyle.spacedParagraph}> <Text style={firstRunStyle.spacedParagraph}>
If you continue to see this message, please request to be verified on the{' '} {__('If you continue to see this message, please request to be verified on the')}{' '}
<Link <Link
style={rewardStyle.underlinedTextLink} style={rewardStyle.underlinedTextLink}
href="https://discordapp.com/invite/Z3bERWA" href="https://discordapp.com/invite/Z3bERWA"
text="LBRY Discord server" text={__('LBRY Discord server')}
/> />
. .
</Text> </Text>
<Text style={firstRunStyle.spacedParagraph}>Please enjoy free content in the meantime!</Text> <Text style={firstRunStyle.spacedParagraph}>{__('Please enjoy free content in the meantime!')}</Text>
</View> </View>
); );
} }

View file

@ -75,7 +75,7 @@ class PhoneVerifyPage extends React.PureComponent {
notify({ message: String(phoneVerifyErrorMessage) }); notify({ message: String(phoneVerifyErrorMessage) });
this.setState({ codeVerifyStarted: false, phoneVerifyFailed: true }); this.setState({ codeVerifyStarted: false, phoneVerifyFailed: true });
} else { } else {
notify({ message: 'Your phone number was successfully verified.' }); notify({ message: __('Your phone number was successfully verified.') });
this.setState({ codeVerifySuccessful: true, phoneVerifyFailed: false }); this.setState({ codeVerifySuccessful: true, phoneVerifyFailed: false });
if (onPhoneVerifySuccessful) { if (onPhoneVerifySuccessful) {
onPhoneVerifySuccessful(); onPhoneVerifySuccessful();
@ -103,7 +103,7 @@ class PhoneVerifyPage extends React.PureComponent {
if (!this.phoneInput.isValidNumber()) { if (!this.phoneInput.isValidNumber()) {
return notify({ return notify({
message: 'Please provide a valid telephone number.', message: __('Please provide a valid telephone number.'),
}); });
} }
@ -145,7 +145,7 @@ class PhoneVerifyPage extends React.PureComponent {
return ( return (
<View style={firstRunStyle.container}> <View style={firstRunStyle.container}>
<Text style={rewardStyle.verificationTitle}> <Text style={rewardStyle.verificationTitle}>
{this.state.phase === Constants.PHASE_VERIFICATION ? 'Verify ' : ''}Phone Number {this.state.phase === Constants.PHASE_VERIFICATION ? __('Verify Phone Number') : __('Phone Number')}
</Text> </Text>
<View style={rewardStyle.phoneVerificationContainer}> <View style={rewardStyle.phoneVerificationContainer}>
@ -169,7 +169,7 @@ class PhoneVerifyPage extends React.PureComponent {
<Button <Button
style={[rewardStyle.verificationButton, rewardStyle.topMarginMedium]} style={[rewardStyle.verificationButton, rewardStyle.topMarginMedium]}
theme={'light'} theme={'light'}
text={'Send verification text'} text={__('Send verification text')}
onPress={this.onSendTextPressed} onPress={this.onSendTextPressed}
/> />
)} )}
@ -187,7 +187,7 @@ class PhoneVerifyPage extends React.PureComponent {
{!phoneVerifyIsPending && !this.codeVerifyStarted && ( {!phoneVerifyIsPending && !this.codeVerifyStarted && (
<View> <View>
<Text style={[rewardStyle.bottomMarginSmall, firstRunStyle.paragraph]}> <Text style={[rewardStyle.bottomMarginSmall, firstRunStyle.paragraph]}>
Please enter the verification code sent to {phone}. {__('Please enter the verification code sent to %phone%', { phone })}.
</Text> </Text>
<TextInput <TextInput
style={rewardStyle.verificationCodeInput} style={rewardStyle.verificationCodeInput}
@ -202,16 +202,16 @@ class PhoneVerifyPage extends React.PureComponent {
<Button <Button
style={[rewardStyle.verificationButton, rewardStyle.topMarginSmall]} style={[rewardStyle.verificationButton, rewardStyle.topMarginSmall]}
theme={'light'} theme={'light'}
text={'Verify'} text={__('Verify')}
onPress={this.onVerifyPressed} onPress={this.onVerifyPressed}
/> />
<Link style={rewardStyle.verificationLink} text={'Edit'} onPress={this.onEditPressed} /> <Link style={rewardStyle.verificationLink} text={__('Edit')} onPress={this.onEditPressed} />
</View> </View>
</View> </View>
)} )}
{phoneVerifyIsPending && ( {phoneVerifyIsPending && (
<View style={firstRunStyle.centered}> <View style={firstRunStyle.centered}>
<Text style={firstRunStyle.paragraph}>Verifying your phone number...</Text> <Text style={firstRunStyle.paragraph}>{__('Verifying your phone number...')}</Text>
<ActivityIndicator <ActivityIndicator
color={Colors.White} color={Colors.White}
size="small" size="small"

View file

@ -14,7 +14,7 @@ class SyncVerifyPage extends React.PureComponent {
state = { state = {
checkSyncStarted: false, checkSyncStarted: false,
password: null, password: null,
placeholder: 'password', placeholder: __('password'),
syncApplyStarted: false, syncApplyStarted: false,
syncApplyCompleted: false, syncApplyCompleted: false,
syncChecked: false, syncChecked: false,
@ -182,7 +182,7 @@ class SyncVerifyPage extends React.PureComponent {
}} }}
onBlur={() => { onBlur={() => {
if (!this.state.password || this.state.password.length === 0) { if (!this.state.password || this.state.password.length === 0) {
this.setState({ placeholder: 'password' }); this.setState({ placeholder: __('password') });
} }
}} }}
/> />

View file

@ -118,6 +118,7 @@ class VerificationScreen extends React.PureComponent {
addUserEmail, addUserEmail,
checkSync, checkSync,
emailNewErrorMessage, emailNewErrorMessage,
emailAlreadyExists,
emailNewPending, emailNewPending,
emailToVerify, emailToVerify,
getSync, getSync,
@ -148,6 +149,7 @@ class VerificationScreen extends React.PureComponent {
page = ( page = (
<EmailVerifyPage <EmailVerifyPage
addUserEmail={addUserEmail} addUserEmail={addUserEmail}
emailAlreadyExists={emailAlreadyExists}
emailNewErrorMessage={emailNewErrorMessage} emailNewErrorMessage={emailNewErrorMessage}
emailNewPending={emailNewPending} emailNewPending={emailNewPending}
emailToVerify={emailToVerify} emailToVerify={emailToVerify}