add bad password action

This commit is contained in:
Sean Yesmunt 2019-10-29 15:14:41 -04:00
parent 5e0bb245ed
commit 31299530d0
7 changed files with 67 additions and 2 deletions

19
dist/bundle.es.js vendored
View file

@ -129,6 +129,7 @@ const SET_DEFAULT_ACCOUNT = 'SET_DEFAULT_ACCOUNT';
const SYNC_APPLY_STARTED = 'SYNC_APPLY_STARTED'; const SYNC_APPLY_STARTED = 'SYNC_APPLY_STARTED';
const SYNC_APPLY_COMPLETED = 'SYNC_APPLY_COMPLETED'; const SYNC_APPLY_COMPLETED = 'SYNC_APPLY_COMPLETED';
const SYNC_APPLY_FAILED = 'SYNC_APPLY_FAILED'; const SYNC_APPLY_FAILED = 'SYNC_APPLY_FAILED';
const SYNC_APPLY_BAD_PASSWORD = 'SYNC_APPLY_BAD_PASSWORD';
const SYNC_RESET = 'SYNC_RESET'; // Lbry.tv const SYNC_RESET = 'SYNC_RESET'; // Lbry.tv
const UPDATE_UPLOAD_PROGRESS = 'UPDATE_UPLOAD_PROGRESS'; const UPDATE_UPLOAD_PROGRESS = 'UPDATE_UPLOAD_PROGRESS';
@ -247,6 +248,7 @@ var action_types = /*#__PURE__*/Object.freeze({
SYNC_APPLY_STARTED: SYNC_APPLY_STARTED, SYNC_APPLY_STARTED: SYNC_APPLY_STARTED,
SYNC_APPLY_COMPLETED: SYNC_APPLY_COMPLETED, SYNC_APPLY_COMPLETED: SYNC_APPLY_COMPLETED,
SYNC_APPLY_FAILED: SYNC_APPLY_FAILED, SYNC_APPLY_FAILED: SYNC_APPLY_FAILED,
SYNC_APPLY_BAD_PASSWORD: SYNC_APPLY_BAD_PASSWORD,
SYNC_RESET: SYNC_RESET, SYNC_RESET: SYNC_RESET,
UPDATE_UPLOAD_PROGRESS: UPDATE_UPLOAD_PROGRESS UPDATE_UPLOAD_PROGRESS: UPDATE_UPLOAD_PROGRESS
}); });
@ -2490,7 +2492,16 @@ function doGetSync(passedPassword, callback) {
data: { 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: SYNC_APPLY_BAD_PASSWORD
}); });
}
handleCallback(error); handleCallback(error);
} else { } else {
// user doesn't have a synced wallet // user doesn't have a synced wallet
@ -3192,6 +3203,7 @@ const defaultState$9 = {
getSyncErrorMessage: null, getSyncErrorMessage: null,
syncApplyErrorMessage: '', syncApplyErrorMessage: '',
syncApplyIsPending: false, syncApplyIsPending: false,
syncApplyPasswordError: false,
getSyncIsPending: false, getSyncIsPending: false,
setSyncIsPending: false, setSyncIsPending: false,
hashChanged: false hashChanged: false
@ -3234,6 +3246,7 @@ reducers$3[SET_SYNC_COMPLETED] = (state, action) => Object.assign({}, state, {
}); });
reducers$3[SYNC_APPLY_STARTED] = state => Object.assign({}, state, { reducers$3[SYNC_APPLY_STARTED] = state => Object.assign({}, state, {
syncApplyPasswordError: false,
syncApplyIsPending: true, syncApplyIsPending: true,
syncApplyErrorMessage: '' syncApplyErrorMessage: ''
}); });
@ -3248,6 +3261,10 @@ reducers$3[SYNC_APPLY_FAILED] = (state, action) => Object.assign({}, state, {
syncApplyErrorMessage: action.data.error syncApplyErrorMessage: action.data.error
}); });
reducers$3[SYNC_APPLY_BAD_PASSWORD] = state => Object.assign({}, state, {
syncApplyPasswordError: true
});
reducers$3[SYNC_RESET] = () => defaultState$9; reducers$3[SYNC_RESET] = () => defaultState$9;
function syncReducer(state = defaultState$9, action) { function syncReducer(state = defaultState$9, action) {
@ -3354,6 +3371,7 @@ const selectSetSyncIsPending = reselect.createSelector(selectState$9, state => s
const selectHashChanged = reselect.createSelector(selectState$9, state => state.hashChanged); const selectHashChanged = reselect.createSelector(selectState$9, state => state.hashChanged);
const selectSyncApplyIsPending = reselect.createSelector(selectState$9, state => state.syncApplyIsPending); const selectSyncApplyIsPending = reselect.createSelector(selectState$9, state => state.syncApplyIsPending);
const selectSyncApplyErrorMessage = reselect.createSelector(selectState$9, state => state.syncApplyErrorMessage); const selectSyncApplyErrorMessage = reselect.createSelector(selectState$9, state => state.syncApplyErrorMessage);
const selectSyncApplyPasswordError = reselect.createSelector(selectState$9, state => state.syncApplyPasswordError);
const selectState$a = state => state.lbrytv || {}; const selectState$a = state => state.lbrytv || {};
@ -3489,6 +3507,7 @@ exports.selectSuggested = selectSuggested;
exports.selectSuggestedChannels = selectSuggestedChannels; exports.selectSuggestedChannels = selectSuggestedChannels;
exports.selectSyncApplyErrorMessage = selectSyncApplyErrorMessage; exports.selectSyncApplyErrorMessage = selectSyncApplyErrorMessage;
exports.selectSyncApplyIsPending = selectSyncApplyIsPending; exports.selectSyncApplyIsPending = selectSyncApplyIsPending;
exports.selectSyncApplyPasswordError = selectSyncApplyPasswordError;
exports.selectSyncData = selectSyncData; exports.selectSyncData = selectSyncData;
exports.selectSyncHash = selectSyncHash; exports.selectSyncHash = selectSyncHash;
exports.selectTrendingUris = selectTrendingUris; exports.selectTrendingUris = selectTrendingUris;

25
dist/bundle.js vendored
View file

@ -461,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__, "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 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"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectCurrentUploads", function() { return redux_selectors_lbrytv__WEBPACK_IMPORTED_MODULE_37__["selectCurrentUploads"]; });
@ -633,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_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_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_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__, "SYNC_RESET", function() { return SYNC_RESET; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UPDATE_UPLOAD_PROGRESS", function() { return UPDATE_UPLOAD_PROGRESS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UPDATE_UPLOAD_PROGRESS", function() { return UPDATE_UPLOAD_PROGRESS; });
// User // User
@ -756,6 +759,7 @@ var SET_DEFAULT_ACCOUNT = 'SET_DEFAULT_ACCOUNT';
var SYNC_APPLY_STARTED = 'SYNC_APPLY_STARTED'; var SYNC_APPLY_STARTED = 'SYNC_APPLY_STARTED';
var SYNC_APPLY_COMPLETED = 'SYNC_APPLY_COMPLETED'; var SYNC_APPLY_COMPLETED = 'SYNC_APPLY_COMPLETED';
var SYNC_APPLY_FAILED = 'SYNC_APPLY_FAILED'; var SYNC_APPLY_FAILED = 'SYNC_APPLY_FAILED';
var SYNC_APPLY_BAD_PASSWORD = 'SYNC_APPLY_BAD_PASSWORD';
var SYNC_RESET = 'SYNC_RESET'; // Lbry.tv var SYNC_RESET = 'SYNC_RESET'; // Lbry.tv
var UPDATE_UPLOAD_PROGRESS = 'UPDATE_UPLOAD_PROGRESS'; var UPDATE_UPLOAD_PROGRESS = 'UPDATE_UPLOAD_PROGRESS';
@ -4084,7 +4088,16 @@ function doGetSync(passedPassword, callback) {
data: { data: {
error: error 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); handleCallback(error);
} else { } else {
// user doesn't have a synced wallet // user doesn't have a synced wallet
@ -4985,6 +4998,7 @@ var defaultState = {
getSyncErrorMessage: null, getSyncErrorMessage: null,
syncApplyErrorMessage: '', syncApplyErrorMessage: '',
syncApplyIsPending: false, syncApplyIsPending: false,
syncApplyPasswordError: false,
getSyncIsPending: false, getSyncIsPending: false,
setSyncIsPending: false, setSyncIsPending: false,
hashChanged: false hashChanged: false
@ -5040,6 +5054,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) { reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["SYNC_APPLY_STARTED"]] = function (state) {
return Object.assign({}, state, { return Object.assign({}, state, {
syncApplyPasswordError: false,
syncApplyIsPending: true, syncApplyIsPending: true,
syncApplyErrorMessage: '' syncApplyErrorMessage: ''
}); });
@ -5059,6 +5074,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 () { reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["SYNC_RESET"]] = function () {
return defaultState; return defaultState;
}; };
@ -5317,6 +5338,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__, "selectHashChanged", function() { return selectHashChanged; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyIsPending", function() { return selectSyncApplyIsPending; }); /* 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__, "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__ = __webpack_require__(14);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__);
@ -5355,6 +5377,9 @@ var selectSyncApplyIsPending = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["cre
var selectSyncApplyErrorMessage = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) { var selectSyncApplyErrorMessage = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.syncApplyErrorMessage; return state.syncApplyErrorMessage;
}); });
var selectSyncApplyPasswordError = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.syncApplyPasswordError;
});
/***/ }), /***/ }),
/* 47 */ /* 47 */

View file

@ -128,6 +128,7 @@ export const SET_DEFAULT_ACCOUNT = 'SET_DEFAULT_ACCOUNT';
export const SYNC_APPLY_STARTED = 'SYNC_APPLY_STARTED'; export const SYNC_APPLY_STARTED = 'SYNC_APPLY_STARTED';
export const SYNC_APPLY_COMPLETED = 'SYNC_APPLY_COMPLETED'; export const SYNC_APPLY_COMPLETED = 'SYNC_APPLY_COMPLETED';
export const SYNC_APPLY_FAILED = 'SYNC_APPLY_FAILED'; export const SYNC_APPLY_FAILED = 'SYNC_APPLY_FAILED';
export const SYNC_APPLY_BAD_PASSWORD = 'SYNC_APPLY_BAD_PASSWORD';
export const SYNC_RESET = 'SYNC_RESET'; export const SYNC_RESET = 'SYNC_RESET';
// Lbry.tv // Lbry.tv

View file

@ -191,5 +191,6 @@ export {
selectSyncApplyIsPending, selectSyncApplyIsPending,
selectHashChanged, selectHashChanged,
selectSyncApplyErrorMessage, selectSyncApplyErrorMessage,
selectSyncApplyPasswordError,
} from 'redux/selectors/sync'; } from 'redux/selectors/sync';
export { selectCurrentUploads, selectUploadCount } from 'redux/selectors/lbrytv'; export { selectCurrentUploads, selectUploadCount } from 'redux/selectors/lbrytv';

View file

@ -142,6 +142,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); handleCallback(error);
} else { } else {
// user doesn't have a synced wallet // user doesn't have a synced wallet

View file

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

View file

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