Compare commits

...

3 commits
master ... test

Author SHA1 Message Date
Sean Yesmunt
ed3a76cd32 test 2019-10-29 16:09:36 -04:00
Sean Yesmunt
f962cdf31a add bad password action 2019-10-29 15:14:41 -04:00
Sean Yesmunt
980c938310 add values for existingUser/resendingVerificationEmail 2019-10-25 14:53:13 -04:00
10 changed files with 199 additions and 43 deletions

73
dist/bundle.es.js vendored
View file

@ -24,7 +24,9 @@ const USER_EMAIL_VERIFY_SET = 'USER_EMAIL_VERIFY_SET';
const USER_EMAIL_VERIFY_STARTED = 'USER_EMAIL_VERIFY_STARTED';
const USER_EMAIL_VERIFY_SUCCESS = 'USER_EMAIL_VERIFY_SUCCESS';
const USER_EMAIL_VERIFY_FAILURE = 'USER_EMAIL_VERIFY_FAILURE';
const USER_EMAIL_VERIFY_RETRY = 'USER_EMAIL_VERIFY_RETRY';
const USER_EMAIL_VERIFY_RETRY_STARTED = 'USER_EMAIL_VERIFY_RETRY_STARTED';
const USER_EMAIL_VERIFY_RETRY_FAILURE = 'USER_EMAIL_VERIFY_RETRY_FAILURE';
const USER_EMAIL_VERIFY_RETRY_SUCCESS = 'USER_EMAIL_VERIFY_RETRY_SUCCESS';
const USER_PHONE_RESET = 'USER_PHONE_RESET';
const USER_PHONE_NEW_STARTED = 'USER_PHONE_NEW_STARTED';
const USER_PHONE_NEW_SUCCESS = 'USER_PHONE_NEW_SUCCESS';
@ -127,6 +129,7 @@ const SET_DEFAULT_ACCOUNT = 'SET_DEFAULT_ACCOUNT';
const SYNC_APPLY_STARTED = 'SYNC_APPLY_STARTED';
const SYNC_APPLY_COMPLETED = 'SYNC_APPLY_COMPLETED';
const SYNC_APPLY_FAILED = 'SYNC_APPLY_FAILED';
const SYNC_APPLY_BAD_PASSWORD = 'SYNC_APPLY_BAD_PASSWORD';
const SYNC_RESET = 'SYNC_RESET'; // Lbry.tv
const UPDATE_UPLOAD_PROGRESS = 'UPDATE_UPLOAD_PROGRESS';
@ -147,7 +150,9 @@ var action_types = /*#__PURE__*/Object.freeze({
USER_EMAIL_VERIFY_STARTED: USER_EMAIL_VERIFY_STARTED,
USER_EMAIL_VERIFY_SUCCESS: USER_EMAIL_VERIFY_SUCCESS,
USER_EMAIL_VERIFY_FAILURE: USER_EMAIL_VERIFY_FAILURE,
USER_EMAIL_VERIFY_RETRY: USER_EMAIL_VERIFY_RETRY,
USER_EMAIL_VERIFY_RETRY_STARTED: USER_EMAIL_VERIFY_RETRY_STARTED,
USER_EMAIL_VERIFY_RETRY_FAILURE: USER_EMAIL_VERIFY_RETRY_FAILURE,
USER_EMAIL_VERIFY_RETRY_SUCCESS: USER_EMAIL_VERIFY_RETRY_SUCCESS,
USER_PHONE_RESET: USER_PHONE_RESET,
USER_PHONE_NEW_STARTED: USER_PHONE_NEW_STARTED,
USER_PHONE_NEW_SUCCESS: USER_PHONE_NEW_SUCCESS,
@ -243,6 +248,7 @@ var action_types = /*#__PURE__*/Object.freeze({
SYNC_APPLY_STARTED: SYNC_APPLY_STARTED,
SYNC_APPLY_COMPLETED: SYNC_APPLY_COMPLETED,
SYNC_APPLY_FAILED: SYNC_APPLY_FAILED,
SYNC_APPLY_BAD_PASSWORD: SYNC_APPLY_BAD_PASSWORD,
SYNC_RESET: SYNC_RESET,
UPDATE_UPLOAD_PROGRESS: UPDATE_UPLOAD_PROGRESS
});
@ -1101,6 +1107,8 @@ const selectState$2 = state => state.user || {};
const selectAuthenticationIsPending = reselect.createSelector(selectState$2, state => state.authenticationIsPending);
const selectUserIsPending = reselect.createSelector(selectState$2, state => state.userIsPending);
const selectUser = reselect.createSelector(selectState$2, state => state.user);
const selectEmailAlreadyExists = reselect.createSelector(selectState$2, state => state.emailAlreadyExists);
const selectResendingVerificationEmail = reselect.createSelector(selectState$2, state => state.resendingVerificationEmail);
const selectUserEmail = reselect.createSelector(selectUser, user => user ? user.primary_email : null);
const selectUserPhone = reselect.createSelector(selectUser, user => user ? user.phone_number : null);
const selectUserCountryCode = reselect.createSelector(selectUser, user => user ? user.country_code : null);
@ -1363,6 +1371,9 @@ function doUserEmailNew(email) {
send_verification_email: true
}, 'post').catch(error => {
if (error.response && error.response.status === 409) {
dispatch({
type: USER_EMAIL_NEW_EXISTS
});
return Lbryio.call('user_email', 'resend_token', {
email,
only_if_expired: true
@ -1376,23 +1387,18 @@ function doUserEmailNew(email) {
function doUserResendVerificationEmail(email) {
return dispatch => {
dispatch({
type: USER_EMAIL_VERIFY_RETRY,
email
type: USER_EMAIL_VERIFY_RETRY_STARTED
});
const success = () => {
dispatch({
type: USER_EMAIL_NEW_SUCCESS,
data: {
email
}
type: USER_EMAIL_VERIFY_RETRY_SUCCESS
});
dispatch(doUserFetch());
};
const failure = error => {
dispatch({
type: USER_EMAIL_NEW_FAILURE,
type: USER_EMAIL_VERIFY_RETRY_FAILURE,
data: {
error
}
@ -2475,7 +2481,9 @@ function doGetSync(passedPassword, callback) {
data
});
handleCallback();
}).catch(() => {
}).catch(err => {
console.error(err);
if (data.hasSyncedWallet) {
const error = 'Error getting synced wallet';
dispatch({
@ -2483,7 +2491,16 @@ function doGetSync(passedPassword, callback) {
data: {
error
}
});
}); // Temp solution until we have a bad password error code
// Don't fail on blank passwords so we don't show a "password error" message
// before users have ever entered a password
if (password !== '') {
dispatch({
type: SYNC_APPLY_BAD_PASSWORD
});
}
handleCallback(error);
} else {
// user doesn't have a synced wallet
@ -2766,6 +2783,8 @@ const defaultState$3 = {
emailNewIsPending: false,
emailNewErrorMessage: '',
emailToVerify: '',
emailAlreadyExists: false,
resendingVerificationEmail: false,
inviteNewErrorMessage: '',
inviteNewIsPending: false,
inviteStatusIsPending: false,
@ -2851,7 +2870,8 @@ reducers$2[USER_PHONE_VERIFY_FAILURE] = (state, action) => Object.assign({}, sta
reducers$2[USER_EMAIL_NEW_STARTED] = state => Object.assign({}, state, {
emailNewIsPending: true,
emailNewErrorMessage: ''
emailNewErrorMessage: '',
emailAlreadyExists: false
});
reducers$2[USER_EMAIL_NEW_SUCCESS] = (state, action) => {
@ -2864,9 +2884,8 @@ reducers$2[USER_EMAIL_NEW_SUCCESS] = (state, action) => {
});
};
reducers$2[USER_EMAIL_NEW_EXISTS] = (state, action) => Object.assign({}, state, {
emailToVerify: action.data.email,
emailNewIsPending: false
reducers$2[USER_EMAIL_NEW_EXISTS] = state => Object.assign({}, state, {
emailAlreadyExists: true
});
reducers$2[USER_EMAIL_NEW_FAILURE] = (state, action) => Object.assign({}, state, {
@ -2976,6 +2995,18 @@ reducers$2[USER_YOUTUBE_IMPORT_FAILURE] = (state, action) => Object.assign({}, s
youtubeChannelImportErrorMessage: action.data
});
reducers$2[USER_EMAIL_VERIFY_RETRY_STARTED] = state => Object.assign({}, state, {
resendingVerificationEmail: true
});
reducers$2[USER_EMAIL_VERIFY_RETRY_SUCCESS] = state => Object.assign({}, state, {
resendingVerificationEmail: false
});
reducers$2[USER_EMAIL_VERIFY_RETRY_FAILURE] = state => Object.assign({}, state, {
resendingVerificationEmail: false
});
function userReducer(state = defaultState$3, action) {
const handler = reducers$2[action.type];
if (handler) return handler(state, action);
@ -3171,6 +3202,7 @@ const defaultState$9 = {
getSyncErrorMessage: null,
syncApplyErrorMessage: '',
syncApplyIsPending: false,
syncApplyPasswordError: false,
getSyncIsPending: false,
setSyncIsPending: false,
hashChanged: false
@ -3213,6 +3245,7 @@ reducers$3[SET_SYNC_COMPLETED] = (state, action) => Object.assign({}, state, {
});
reducers$3[SYNC_APPLY_STARTED] = state => Object.assign({}, state, {
syncApplyPasswordError: false,
syncApplyIsPending: true,
syncApplyErrorMessage: ''
});
@ -3227,6 +3260,10 @@ reducers$3[SYNC_APPLY_FAILED] = (state, action) => Object.assign({}, state, {
syncApplyErrorMessage: action.data.error
});
reducers$3[SYNC_APPLY_BAD_PASSWORD] = state => Object.assign({}, state, {
syncApplyPasswordError: true
});
reducers$3[SYNC_RESET] = () => defaultState$9;
function syncReducer(state = defaultState$9, action) {
@ -3333,6 +3370,7 @@ const selectSetSyncIsPending = reselect.createSelector(selectState$9, state => s
const selectHashChanged = reselect.createSelector(selectState$9, state => state.hashChanged);
const selectSyncApplyIsPending = reselect.createSelector(selectState$9, state => state.syncApplyIsPending);
const selectSyncApplyErrorMessage = reselect.createSelector(selectState$9, state => state.syncApplyErrorMessage);
const selectSyncApplyPasswordError = reselect.createSelector(selectState$9, state => state.syncApplyPasswordError);
const selectState$a = state => state.lbrytv || {};
@ -3427,6 +3465,7 @@ exports.selectClaimedRewardsById = selectClaimedRewardsById;
exports.selectClaimedRewardsByTransactionId = selectClaimedRewardsByTransactionId;
exports.selectClaimsPendingByType = selectClaimsPendingByType;
exports.selectCurrentUploads = selectCurrentUploads;
exports.selectEmailAlreadyExists = selectEmailAlreadyExists;
exports.selectEmailNewErrorMessage = selectEmailNewErrorMessage;
exports.selectEmailNewIsPending = selectEmailNewIsPending;
exports.selectEmailToVerify = selectEmailToVerify;
@ -3455,6 +3494,7 @@ exports.selectPhoneToVerify = selectPhoneToVerify;
exports.selectPhoneVerifyErrorMessage = selectPhoneVerifyErrorMessage;
exports.selectPhoneVerifyIsPending = selectPhoneVerifyIsPending;
exports.selectReferralReward = selectReferralReward;
exports.selectResendingVerificationEmail = selectResendingVerificationEmail;
exports.selectRewardContentClaimIds = selectRewardContentClaimIds;
exports.selectSetSyncErrorMessage = selectSetSyncErrorMessage;
exports.selectSetSyncIsPending = selectSetSyncIsPending;
@ -3466,6 +3506,7 @@ exports.selectSuggested = selectSuggested;
exports.selectSuggestedChannels = selectSuggestedChannels;
exports.selectSyncApplyErrorMessage = selectSyncApplyErrorMessage;
exports.selectSyncApplyIsPending = selectSyncApplyIsPending;
exports.selectSyncApplyPasswordError = selectSyncApplyPasswordError;
exports.selectSyncData = selectSyncData;
exports.selectSyncHash = selectSyncHash;
exports.selectTrendingUris = selectTrendingUris;

93
dist/bundle.js vendored
View file

@ -371,6 +371,10 @@ __webpack_require__.r(__webpack_exports__);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectEmailVerifyErrorMessage", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_30__["selectEmailVerifyErrorMessage"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectEmailAlreadyExists", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_30__["selectEmailAlreadyExists"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectResendingVerificationEmail", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_30__["selectResendingVerificationEmail"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectPhoneVerifyErrorMessage", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_30__["selectPhoneVerifyErrorMessage"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectPhoneVerifyIsPending", function() { return redux_selectors_user__WEBPACK_IMPORTED_MODULE_30__["selectPhoneVerifyIsPending"]; });
@ -457,6 +461,8 @@ __webpack_require__.r(__webpack_exports__);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyErrorMessage", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_36__["selectSyncApplyErrorMessage"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyPasswordError", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_36__["selectSyncApplyPasswordError"]; });
/* harmony import */ var redux_selectors_lbrytv__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(47);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectCurrentUploads", function() { return redux_selectors_lbrytv__WEBPACK_IMPORTED_MODULE_37__["selectCurrentUploads"]; });
@ -531,7 +537,9 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_STARTED", function() { return USER_EMAIL_VERIFY_STARTED; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_SUCCESS", function() { return USER_EMAIL_VERIFY_SUCCESS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_FAILURE", function() { return USER_EMAIL_VERIFY_FAILURE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_RETRY", function() { return USER_EMAIL_VERIFY_RETRY; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_RETRY_STARTED", function() { return USER_EMAIL_VERIFY_RETRY_STARTED; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_RETRY_FAILURE", function() { return USER_EMAIL_VERIFY_RETRY_FAILURE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_EMAIL_VERIFY_RETRY_SUCCESS", function() { return USER_EMAIL_VERIFY_RETRY_SUCCESS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_PHONE_RESET", function() { return USER_PHONE_RESET; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_PHONE_NEW_STARTED", function() { return USER_PHONE_NEW_STARTED; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "USER_PHONE_NEW_SUCCESS", function() { return USER_PHONE_NEW_SUCCESS; });
@ -627,6 +635,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SYNC_APPLY_STARTED", function() { return SYNC_APPLY_STARTED; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SYNC_APPLY_COMPLETED", function() { return SYNC_APPLY_COMPLETED; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SYNC_APPLY_FAILED", function() { return SYNC_APPLY_FAILED; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SYNC_APPLY_BAD_PASSWORD", function() { return SYNC_APPLY_BAD_PASSWORD; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SYNC_RESET", function() { return SYNC_RESET; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UPDATE_UPLOAD_PROGRESS", function() { return UPDATE_UPLOAD_PROGRESS; });
// User
@ -645,7 +654,9 @@ var USER_EMAIL_VERIFY_SET = 'USER_EMAIL_VERIFY_SET';
var USER_EMAIL_VERIFY_STARTED = 'USER_EMAIL_VERIFY_STARTED';
var USER_EMAIL_VERIFY_SUCCESS = 'USER_EMAIL_VERIFY_SUCCESS';
var USER_EMAIL_VERIFY_FAILURE = 'USER_EMAIL_VERIFY_FAILURE';
var USER_EMAIL_VERIFY_RETRY = 'USER_EMAIL_VERIFY_RETRY';
var USER_EMAIL_VERIFY_RETRY_STARTED = 'USER_EMAIL_VERIFY_RETRY_STARTED';
var USER_EMAIL_VERIFY_RETRY_FAILURE = 'USER_EMAIL_VERIFY_RETRY_FAILURE';
var USER_EMAIL_VERIFY_RETRY_SUCCESS = 'USER_EMAIL_VERIFY_RETRY_SUCCESS';
var USER_PHONE_RESET = 'USER_PHONE_RESET';
var USER_PHONE_NEW_STARTED = 'USER_PHONE_NEW_STARTED';
var USER_PHONE_NEW_SUCCESS = 'USER_PHONE_NEW_SUCCESS';
@ -748,6 +759,7 @@ var SET_DEFAULT_ACCOUNT = 'SET_DEFAULT_ACCOUNT';
var SYNC_APPLY_STARTED = 'SYNC_APPLY_STARTED';
var SYNC_APPLY_COMPLETED = 'SYNC_APPLY_COMPLETED';
var SYNC_APPLY_FAILED = 'SYNC_APPLY_FAILED';
var SYNC_APPLY_BAD_PASSWORD = 'SYNC_APPLY_BAD_PASSWORD';
var SYNC_RESET = 'SYNC_RESET'; // Lbry.tv
var UPDATE_UPLOAD_PROGRESS = 'UPDATE_UPLOAD_PROGRESS';
@ -2432,6 +2444,8 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectAuthenticationIsPending", function() { return selectAuthenticationIsPending; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserIsPending", function() { return selectUserIsPending; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUser", function() { return selectUser; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectEmailAlreadyExists", function() { return selectEmailAlreadyExists; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectResendingVerificationEmail", function() { return selectResendingVerificationEmail; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserEmail", function() { return selectUserEmail; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserPhone", function() { return selectUserPhone; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUserCountryCode", function() { return selectUserCountryCode; });
@ -2477,6 +2491,12 @@ var selectUserIsPending = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSe
var selectUser = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.user;
});
var selectEmailAlreadyExists = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.emailAlreadyExists;
});
var selectResendingVerificationEmail = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.resendingVerificationEmail;
});
var selectUserEmail = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectUser, function (user) {
return user ? user.primary_email : null;
});
@ -2853,6 +2873,9 @@ function doUserEmailNew(email) {
send_verification_email: true
}, 'post')["catch"](function (error) {
if (error.response && error.response.status === 409) {
dispatch({
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_EXISTS"]
});
return lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].call('user_email', 'resend_token', {
email: email,
only_if_expired: true
@ -2866,23 +2889,18 @@ function doUserEmailNew(email) {
function doUserResendVerificationEmail(email) {
return function (dispatch) {
dispatch({
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_VERIFY_RETRY"],
email: email
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_VERIFY_RETRY_STARTED"]
});
var success = function success() {
dispatch({
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_SUCCESS"],
data: {
email: email
}
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_VERIFY_RETRY_SUCCESS"]
});
dispatch(doUserFetch());
};
var failure = function failure(error) {
dispatch({
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_FAILURE"],
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_VERIFY_RETRY_FAILURE"],
data: {
error: error
}
@ -4059,7 +4077,9 @@ function doGetSync(passedPassword, callback) {
data: data
});
handleCallback();
})["catch"](function () {
})["catch"](function (err) {
console.error(err);
if (data.hasSyncedWallet) {
var error = 'Error getting synced wallet';
dispatch({
@ -4067,7 +4087,16 @@ function doGetSync(passedPassword, callback) {
data: {
error: error
}
});
}); // Temp solution until we have a bad password error code
// Don't fail on blank passwords so we don't show a "password error" message
// before users have ever entered a password
if (password !== '') {
dispatch({
type: constants_action_types__WEBPACK_IMPORTED_MODULE_0__["SYNC_APPLY_BAD_PASSWORD"]
});
}
handleCallback(error);
} else {
// user doesn't have a synced wallet
@ -4407,6 +4436,8 @@ var defaultState = {
emailNewIsPending: false,
emailNewErrorMessage: '',
emailToVerify: '',
emailAlreadyExists: false,
resendingVerificationEmail: false,
inviteNewErrorMessage: '',
inviteNewIsPending: false,
inviteStatusIsPending: false,
@ -4517,7 +4548,8 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_PHONE_VERIFY_
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_NEW_STARTED"]] = function (state) {
return Object.assign({}, state, {
emailNewIsPending: true,
emailNewErrorMessage: ''
emailNewErrorMessage: '',
emailAlreadyExists: false
});
};
@ -4531,10 +4563,9 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_NEW_SUC
});
};
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_NEW_EXISTS"]] = function (state, action) {
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_NEW_EXISTS"]] = function (state) {
return Object.assign({}, state, {
emailToVerify: action.data.email,
emailNewIsPending: false
emailAlreadyExists: true
});
};
@ -4677,6 +4708,24 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_YOUTUBE_IMPOR
});
};
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_VERIFY_RETRY_STARTED"]] = function (state) {
return Object.assign({}, state, {
resendingVerificationEmail: true
});
};
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_VERIFY_RETRY_SUCCESS"]] = function (state) {
return Object.assign({}, state, {
resendingVerificationEmail: false
});
};
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_VERIFY_RETRY_FAILURE"]] = function (state) {
return Object.assign({}, state, {
resendingVerificationEmail: false
});
};
function userReducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
var action = arguments.length > 1 ? arguments[1] : undefined;
@ -4948,6 +4997,7 @@ var defaultState = {
getSyncErrorMessage: null,
syncApplyErrorMessage: '',
syncApplyIsPending: false,
syncApplyPasswordError: false,
getSyncIsPending: false,
setSyncIsPending: false,
hashChanged: false
@ -5003,6 +5053,7 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["SET_SYNC_COMPLETED
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["SYNC_APPLY_STARTED"]] = function (state) {
return Object.assign({}, state, {
syncApplyPasswordError: false,
syncApplyIsPending: true,
syncApplyErrorMessage: ''
});
@ -5022,6 +5073,12 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["SYNC_APPLY_FAILED"
});
};
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["SYNC_APPLY_BAD_PASSWORD"]] = function (state) {
return Object.assign({}, state, {
syncApplyPasswordError: true
});
};
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["SYNC_RESET"]] = function () {
return defaultState;
};
@ -5280,6 +5337,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectHashChanged", function() { return selectHashChanged; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyIsPending", function() { return selectSyncApplyIsPending; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyErrorMessage", function() { return selectSyncApplyErrorMessage; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyPasswordError", function() { return selectSyncApplyPasswordError; });
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__);
@ -5318,6 +5376,9 @@ var selectSyncApplyIsPending = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["cre
var selectSyncApplyErrorMessage = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.syncApplyErrorMessage;
});
var selectSyncApplyPasswordError = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.syncApplyPasswordError;
});
/***/ }),
/* 47 */

View file

@ -14,7 +14,9 @@ export const USER_EMAIL_VERIFY_SET = 'USER_EMAIL_VERIFY_SET';
export const USER_EMAIL_VERIFY_STARTED = 'USER_EMAIL_VERIFY_STARTED';
export const USER_EMAIL_VERIFY_SUCCESS = 'USER_EMAIL_VERIFY_SUCCESS';
export const USER_EMAIL_VERIFY_FAILURE = 'USER_EMAIL_VERIFY_FAILURE';
export const USER_EMAIL_VERIFY_RETRY = 'USER_EMAIL_VERIFY_RETRY';
export const USER_EMAIL_VERIFY_RETRY_STARTED = 'USER_EMAIL_VERIFY_RETRY_STARTED';
export const USER_EMAIL_VERIFY_RETRY_FAILURE = 'USER_EMAIL_VERIFY_RETRY_FAILURE';
export const USER_EMAIL_VERIFY_RETRY_SUCCESS = 'USER_EMAIL_VERIFY_RETRY_SUCCESS';
export const USER_PHONE_RESET = 'USER_PHONE_RESET';
export const USER_PHONE_NEW_STARTED = 'USER_PHONE_NEW_STARTED';
export const USER_PHONE_NEW_SUCCESS = 'USER_PHONE_NEW_SUCCESS';
@ -126,6 +128,7 @@ export const SET_DEFAULT_ACCOUNT = 'SET_DEFAULT_ACCOUNT';
export const SYNC_APPLY_STARTED = 'SYNC_APPLY_STARTED';
export const SYNC_APPLY_COMPLETED = 'SYNC_APPLY_COMPLETED';
export const SYNC_APPLY_FAILED = 'SYNC_APPLY_FAILED';
export const SYNC_APPLY_BAD_PASSWORD = 'SYNC_APPLY_BAD_PASSWORD';
export const SYNC_RESET = 'SYNC_RESET';
// Lbry.tv

View file

@ -144,6 +144,8 @@ export {
selectPhoneNewIsPending,
selectEmailVerifyIsPending,
selectEmailVerifyErrorMessage,
selectEmailAlreadyExists,
selectResendingVerificationEmail,
selectPhoneVerifyErrorMessage,
selectPhoneVerifyIsPending,
selectIdentityVerifyIsPending,
@ -189,5 +191,6 @@ export {
selectSyncApplyIsPending,
selectHashChanged,
selectSyncApplyErrorMessage,
selectSyncApplyPasswordError,
} from 'redux/selectors/sync';
export { selectCurrentUploads, selectUploadCount } from 'redux/selectors/lbrytv';

View file

@ -132,7 +132,8 @@ export function doGetSync(passedPassword, callback) {
dispatch({ type: ACTIONS.GET_SYNC_COMPLETED, data });
handleCallback();
})
.catch(() => {
.catch(err => {
console.error(err);
if (data.hasSyncedWallet) {
const error = 'Error getting synced wallet';
dispatch({
@ -142,6 +143,13 @@ export function doGetSync(passedPassword, callback) {
},
});
// Temp solution until we have a bad password error code
// Don't fail on blank passwords so we don't show a "password error" message
// before users have ever entered a password
if (password !== '') {
dispatch({ type: ACTIONS.SYNC_APPLY_BAD_PASSWORD });
}
handleCallback(error);
} else {
// user doesn't have a synced wallet

View file

@ -230,6 +230,10 @@ export function doUserEmailNew(email) {
Lbryio.call('user_email', 'new', { email, send_verification_email: true }, 'post')
.catch(error => {
if (error.response && error.response.status === 409) {
dispatch({
type: ACTIONS.USER_EMAIL_NEW_EXISTS,
});
return Lbryio.call(
'user_email',
'resend_token',
@ -246,21 +250,18 @@ export function doUserEmailNew(email) {
export function doUserResendVerificationEmail(email) {
return dispatch => {
dispatch({
type: ACTIONS.USER_EMAIL_VERIFY_RETRY,
email,
type: ACTIONS.USER_EMAIL_VERIFY_RETRY_STARTED,
});
const success = () => {
dispatch({
type: ACTIONS.USER_EMAIL_NEW_SUCCESS,
data: { email },
type: ACTIONS.USER_EMAIL_VERIFY_RETRY_SUCCESS,
});
dispatch(doUserFetch());
};
const failure = error => {
dispatch({
type: ACTIONS.USER_EMAIL_NEW_FAILURE,
type: ACTIONS.USER_EMAIL_VERIFY_RETRY_FAILURE,
data: { error },
});
};

View file

@ -9,6 +9,7 @@ const defaultState = {
getSyncErrorMessage: null,
syncApplyErrorMessage: '',
syncApplyIsPending: false,
syncApplyPasswordError: false,
getSyncIsPending: false,
setSyncIsPending: false,
hashChanged: false,
@ -57,6 +58,7 @@ reducers[ACTIONS.SET_SYNC_COMPLETED] = (state, action) =>
reducers[ACTIONS.SYNC_APPLY_STARTED] = state =>
Object.assign({}, state, {
syncApplyPasswordError: false,
syncApplyIsPending: true,
syncApplyErrorMessage: '',
});
@ -73,6 +75,11 @@ reducers[ACTIONS.SYNC_APPLY_FAILED] = (state, action) =>
syncApplyErrorMessage: action.data.error,
});
reducers[ACTIONS.SYNC_APPLY_BAD_PASSWORD] = state =>
Object.assign({}, state, {
syncApplyPasswordError: true,
});
reducers[ACTIONS.SYNC_RESET] = () => defaultState;
export function syncReducer(state = defaultState, action) {

View file

@ -8,6 +8,8 @@ const defaultState = {
emailNewIsPending: false,
emailNewErrorMessage: '',
emailToVerify: '',
emailAlreadyExists: false,
resendingVerificationEmail: false,
inviteNewErrorMessage: '',
inviteNewIsPending: false,
inviteStatusIsPending: false,
@ -107,6 +109,7 @@ reducers[ACTIONS.USER_EMAIL_NEW_STARTED] = state =>
Object.assign({}, state, {
emailNewIsPending: true,
emailNewErrorMessage: '',
emailAlreadyExists: false,
});
reducers[ACTIONS.USER_EMAIL_NEW_SUCCESS] = (state, action) => {
@ -119,10 +122,9 @@ reducers[ACTIONS.USER_EMAIL_NEW_SUCCESS] = (state, action) => {
});
};
reducers[ACTIONS.USER_EMAIL_NEW_EXISTS] = (state, action) =>
reducers[ACTIONS.USER_EMAIL_NEW_EXISTS] = state =>
Object.assign({}, state, {
emailToVerify: action.data.email,
emailNewIsPending: false,
emailAlreadyExists: true,
});
reducers[ACTIONS.USER_EMAIL_NEW_FAILURE] = (state, action) =>
@ -248,6 +250,21 @@ reducers[ACTIONS.USER_YOUTUBE_IMPORT_FAILURE] = (state, action) =>
youtubeChannelImportErrorMessage: action.data,
});
reducers[ACTIONS.USER_EMAIL_VERIFY_RETRY_STARTED] = state =>
Object.assign({}, state, {
resendingVerificationEmail: true,
});
reducers[ACTIONS.USER_EMAIL_VERIFY_RETRY_SUCCESS] = state =>
Object.assign({}, state, {
resendingVerificationEmail: false,
});
reducers[ACTIONS.USER_EMAIL_VERIFY_RETRY_FAILURE] = state =>
Object.assign({}, state, {
resendingVerificationEmail: false,
});
export function userReducer(state = defaultState, action) {
const handler = reducers[action.type];
if (handler) return handler(state, action);

View file

@ -33,3 +33,8 @@ export const selectSyncApplyErrorMessage = createSelector(
selectState,
state => state.syncApplyErrorMessage
);
export const selectSyncApplyPasswordError = createSelector(
selectState,
state => state.syncApplyPasswordError
);

View file

@ -11,6 +11,16 @@ export const selectUserIsPending = createSelector(selectState, state => state.us
export const selectUser = createSelector(selectState, state => state.user);
export const selectEmailAlreadyExists = createSelector(
selectState,
state => state.emailAlreadyExists
);
export const selectResendingVerificationEmail = createSelector(
selectState,
state => state.resendingVerificationEmail
);
export const selectUserEmail = createSelector(
selectUser,
user => (user ? user.primary_email : null)