don't let users login if they are partway through a signup

This commit is contained in:
Sean Yesmunt 2020-04-20 16:53:40 -04:00
parent 3682a31f14
commit 46c3538c8e
7 changed files with 15 additions and 6 deletions

View file

@ -131,7 +131,7 @@
"json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#ee29e9a024f8a24e7eb70ecc901bb05ff3d4a87d",
"lbryinc": "lbryio/lbryinc#43fadef68d10f5f0727e3b94f6778164e94ae428",
"lbryinc": "lbryio/lbryinc#edd43c8dff63bccd86400719679c6fa864a9a342",
"lint-staged": "^7.0.2",
"localforage": "^1.7.1",
"lodash-es": "^4.17.14",

View file

@ -6,6 +6,7 @@ import {
selectEmailAlreadyExists,
doUserSignUp,
doClearEmailEntry,
selectUser,
} from 'lbryinc';
import { DAEMON_SETTINGS } from 'lbry-redux';
import { doSetClientSetting, doSetDaemonSetting } from 'redux/actions/settings';
@ -18,6 +19,7 @@ const select = state => ({
syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state),
daemonSettings: selectDaemonSettings(state),
emailExists: selectEmailAlreadyExists(state),
user: selectUser(state),
});
const perform = dispatch => ({

View file

@ -6,6 +6,7 @@ import {
doClearEmailEntry,
selectEmailDoesNotExist,
selectEmailAlreadyExists,
selectUser,
} from 'lbryinc';
import { doSetClientSetting } from 'redux/actions/settings';
import UserEmailReturning from './view';
@ -15,6 +16,7 @@ const select = state => ({
emailToVerify: selectEmailToVerify(state),
emailDoesNotExist: selectEmailDoesNotExist(state),
emailExists: selectEmailAlreadyExists(state),
user: selectUser(state),
});
export default connect(select, {

View file

@ -11,6 +11,7 @@ import Card from 'component/common/card';
import Nag from 'component/common/nag';
type Props = {
user: ?User,
errorMessage: ?string,
emailToVerify: ?string,
emailDoesNotExist: boolean,
@ -22,6 +23,7 @@ type Props = {
function UserEmailReturning(props: Props) {
const {
user,
errorMessage,
doUserCheckIfEmailExists,
emailToVerify,
@ -34,11 +36,13 @@ function UserEmailReturning(props: Props) {
const emailFromUrl = urlParams.get('email');
const emailExistsFromUrl = urlParams.get('email_exists');
const defaultEmail = emailFromUrl ? decodeURIComponent(emailFromUrl) : '';
const hasPasswordSet = user && user.password_set;
const [email, setEmail] = useState(defaultEmail);
const [syncEnabled, setSyncEnabled] = useState(true);
const valid = email.match(EMAIL_REGEX);
const showEmailVerification = emailToVerify;
const showEmailVerification = emailToVerify || hasPasswordSet;
function handleSubmit() {
// @if TARGET='app'

View file

@ -18,7 +18,7 @@ type Props = {
function UserFirstChannel(props: Props) {
const { createChannel, creatingChannel, claimingReward, user, createChannelError } = props;
const { primary_email: primaryEmail } = user;
const initialChannel = primaryEmail.split('@')[0];
const initialChannel = primaryEmail ? primaryEmail.split('@')[0] : '';
const [channel, setChannel] = useState(initialChannel);
const [nameError, setNameError] = useState(undefined);

View file

@ -69,6 +69,7 @@ function UserSignIn(props: Props) {
const hasVerifiedEmail = user && user.has_verified_email;
const rewardsApproved = user && user.is_reward_approved;
const isIdentityVerified = user && user.is_identity_verified;
const passwordSet = user && user.password_set;
const hasFetchedReward = useFetched(claimingReward);
const channelCount = channels ? channels.length : 0;
const hasClaimedEmailAward = claimedRewards.some(reward => reward.reward_type === REWARDS.TYPE_CONFIRM_EMAIL);
@ -84,7 +85,7 @@ function UserSignIn(props: Props) {
// reward claiming, channel creation, account syncing, and youtube transfer
// The possible screens for the sign in flow
const showEmail = !hasVerifiedEmail;
const showEmailVerification = emailToVerify && !hasVerifiedEmail;
const showEmailVerification = (emailToVerify && !hasVerifiedEmail) || (!hasVerifiedEmail && passwordSet);
const showUserVerification = hasVerifiedEmail && !rewardsApproved && !isIdentityVerified && !hasSkippedRewards;
const showSyncPassword = syncEnabled && getSyncError;
const showChannelCreation =

View file

@ -6147,9 +6147,9 @@ lbry-redux@lbryio/lbry-redux#ee29e9a024f8a24e7eb70ecc901bb05ff3d4a87d:
reselect "^3.0.0"
uuid "^3.3.2"
lbryinc@lbryio/lbryinc#43fadef68d10f5f0727e3b94f6778164e94ae428:
lbryinc@lbryio/lbryinc#edd43c8dff63bccd86400719679c6fa864a9a342:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/43fadef68d10f5f0727e3b94f6778164e94ae428"
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/edd43c8dff63bccd86400719679c6fa864a9a342"
dependencies:
reselect "^3.0.0"