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", "json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git", "lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#ee29e9a024f8a24e7eb70ecc901bb05ff3d4a87d", "lbry-redux": "lbryio/lbry-redux#ee29e9a024f8a24e7eb70ecc901bb05ff3d4a87d",
"lbryinc": "lbryio/lbryinc#43fadef68d10f5f0727e3b94f6778164e94ae428", "lbryinc": "lbryio/lbryinc#edd43c8dff63bccd86400719679c6fa864a9a342",
"lint-staged": "^7.0.2", "lint-staged": "^7.0.2",
"localforage": "^1.7.1", "localforage": "^1.7.1",
"lodash-es": "^4.17.14", "lodash-es": "^4.17.14",

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -6147,9 +6147,9 @@ lbry-redux@lbryio/lbry-redux#ee29e9a024f8a24e7eb70ecc901bb05ff3d4a87d:
reselect "^3.0.0" reselect "^3.0.0"
uuid "^3.3.2" uuid "^3.3.2"
lbryinc@lbryio/lbryinc#43fadef68d10f5f0727e3b94f6778164e94ae428: lbryinc@lbryio/lbryinc#edd43c8dff63bccd86400719679c6fa864a9a342:
version "0.0.1" 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: dependencies:
reselect "^3.0.0" reselect "^3.0.0"