Merge pull request #93 from lbryio/fixes

password sign in cleanup
This commit is contained in:
Sean Yesmunt 2020-04-13 13:45:01 -04:00 committed by GitHub
commit 12aefaa143
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 65 additions and 38 deletions

67
dist/bundle.es.js vendored
View file

@ -1397,31 +1397,29 @@ function doAuthenticate(appVersion, os = null, firebaseToken = null, shareUsageD
}; };
} }
function doUserFetch() { function doUserFetch() {
return dispatch => { return dispatch => new Promise((resolve, reject) => {
return new Promise((resolve, reject) => { dispatch({
type: USER_FETCH_STARTED
});
Lbryio.getCurrentUser().then(user => {
dispatch(doRewardList());
dispatch({ dispatch({
type: USER_FETCH_STARTED type: USER_FETCH_SUCCESS,
data: {
user
}
}); });
Lbryio.getCurrentUser().then(user => { resolve(user);
dispatch(doRewardList()); }).catch(error => {
dispatch({ reject(error);
type: USER_FETCH_SUCCESS, dispatch({
data: { type: USER_FETCH_FAILURE,
user data: {
} error
}); }
resolve(user);
}).catch(error => {
reject(error);
dispatch({
type: USER_FETCH_FAILURE,
data: {
error
}
});
}); });
}); });
}; });
} }
function doUserCheckEmailVerified() { function doUserCheckEmailVerified() {
// This will happen in the background so we don't need loading booleans // This will happen in the background so we don't need loading booleans
@ -1579,6 +1577,9 @@ function doUserCheckIfEmailExists(email) {
email email
} }
}); });
dispatch({
type: USER_EMAIL_NEW_EXISTS
});
if (response.has_password) { if (response.has_password) {
dispatch({ dispatch({
@ -1782,7 +1783,7 @@ function doClearEmailEntry() {
type: USER_EMAIL_NEW_CLEAR_ENTRY type: USER_EMAIL_NEW_CLEAR_ENTRY
}; };
} }
function doClearPasswordEntries() { function doClearPasswordEntry() {
return { return {
type: USER_PASSWORD_SET_CLEAR type: USER_PASSWORD_SET_CLEAR
}; };
@ -3395,13 +3396,19 @@ reducers$2[USER_EMAIL_NEW_FAILURE] = (state, action) => Object.assign({}, state,
emailNewErrorMessage: action.data.error emailNewErrorMessage: action.data.error
}); });
reducers$2[USER_EMAIL_NEW_CLEAR_ENTRY] = state => Object.assign({}, state, { reducers$2[USER_EMAIL_NEW_CLEAR_ENTRY] = state => {
emailNewErrorMessage: null, const newUser = { ...state.user
emailAlreadyExists: false, };
emailDoesNotExist: false, delete newUser.primary_email;
passwordExistsForUser: false, return Object.assign({}, state, {
emailToVerify: null emailNewErrorMessage: null,
}); emailAlreadyExists: false,
emailDoesNotExist: false,
passwordExistsForUser: false,
emailToVerify: null,
user: newUser
});
};
reducers$2[USER_PASSWORD_SET_CLEAR] = state => Object.assign({}, state, { reducers$2[USER_PASSWORD_SET_CLEAR] = state => Object.assign({}, state, {
passwordResetSuccess: false, passwordResetSuccess: false,
@ -3972,7 +3979,7 @@ exports.doClaimRewardClearError = doClaimRewardClearError;
exports.doClaimRewardType = doClaimRewardType; exports.doClaimRewardType = doClaimRewardType;
exports.doClaimYoutubeChannels = doClaimYoutubeChannels; exports.doClaimYoutubeChannels = doClaimYoutubeChannels;
exports.doClearEmailEntry = doClearEmailEntry; exports.doClearEmailEntry = doClearEmailEntry;
exports.doClearPasswordEntries = doClearPasswordEntries; exports.doClearPasswordEntry = doClearPasswordEntry;
exports.doCompleteFirstRun = doCompleteFirstRun; exports.doCompleteFirstRun = doCompleteFirstRun;
exports.doFetchAccessToken = doFetchAccessToken; exports.doFetchAccessToken = doFetchAccessToken;
exports.doFetchCostInfoForUri = doFetchCostInfoForUri; exports.doFetchCostInfoForUri = doFetchCostInfoForUri;

19
dist/bundle.js vendored
View file

@ -225,7 +225,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doClearEmailEntry", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_11__["doClearEmailEntry"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doClearEmailEntry", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_11__["doClearEmailEntry"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doClearPasswordEntries", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_11__["doClearPasswordEntries"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doClearPasswordEntry", function() { return redux_actions_user__WEBPACK_IMPORTED_MODULE_11__["doClearPasswordEntry"]; });
/* harmony import */ var redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(30); /* harmony import */ var redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(30);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchCostInfoForUri", function() { return redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_12__["doFetchCostInfoForUri"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchCostInfoForUri", function() { return redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_12__["doFetchCostInfoForUri"]; });
@ -4955,7 +4955,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserPasswordSet", function() { return doUserPasswordSet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserPasswordSet", function() { return doUserPasswordSet; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserResendVerificationEmail", function() { return doUserResendVerificationEmail; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserResendVerificationEmail", function() { return doUserResendVerificationEmail; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doClearEmailEntry", function() { return doClearEmailEntry; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doClearEmailEntry", function() { return doClearEmailEntry; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doClearPasswordEntries", function() { return doClearPasswordEntries; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doClearPasswordEntry", function() { return doClearPasswordEntry; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserEmailVerifyFailure", function() { return doUserEmailVerifyFailure; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserEmailVerifyFailure", function() { return doUserEmailVerifyFailure; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserEmailVerify", function() { return doUserEmailVerify; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doUserEmailVerify", function() { return doUserEmailVerify; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doFetchAccessToken", function() { return doFetchAccessToken; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doFetchAccessToken", function() { return doFetchAccessToken; });
@ -5295,6 +5295,9 @@ function doUserCheckIfEmailExists(email) {
email: email email: email
} }
}); });
dispatch({
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_EXISTS"]
});
if (response.has_password) { if (response.has_password) {
dispatch({ dispatch({
@ -5502,7 +5505,7 @@ function doClearEmailEntry() {
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_CLEAR_ENTRY"] type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_EMAIL_NEW_CLEAR_ENTRY"]
}; };
} }
function doClearPasswordEntries() { function doClearPasswordEntry() {
return { return {
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_PASSWORD_SET_CLEAR"] type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["USER_PASSWORD_SET_CLEAR"]
}; };
@ -7168,6 +7171,10 @@ function rewardsReducer() {
__webpack_require__.r(__webpack_exports__); __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "userReducer", function() { return userReducer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "userReducer", function() { return userReducer; });
/* harmony import */ var constants_action_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); /* harmony import */ var constants_action_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var reducers = {}; var reducers = {};
var defaultState = { var defaultState = {
@ -7337,12 +7344,16 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_NEW_FAI
}; };
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_NEW_CLEAR_ENTRY"]] = function (state) { reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["USER_EMAIL_NEW_CLEAR_ENTRY"]] = function (state) {
var newUser = _objectSpread({}, state.user);
delete newUser.primary_email;
return Object.assign({}, state, { return Object.assign({}, state, {
emailNewErrorMessage: null, emailNewErrorMessage: null,
emailAlreadyExists: false, emailAlreadyExists: false,
emailDoesNotExist: false, emailDoesNotExist: false,
passwordExistsForUser: false, passwordExistsForUser: false,
emailToVerify: null emailToVerify: null,
user: newUser
}); });
}; };

View file

@ -73,7 +73,7 @@ export {
doUserPasswordSet, doUserPasswordSet,
doUserCheckIfEmailExists, doUserCheckIfEmailExists,
doClearEmailEntry, doClearEmailEntry,
doClearPasswordEntries, doClearPasswordEntry,
} from 'redux/actions/user'; } from 'redux/actions/user';
export { doFetchCostInfoForUri } from 'redux/actions/cost_info'; export { doFetchCostInfoForUri } from 'redux/actions/cost_info';
export { doBlackListedOutpointsSubscribe } from 'redux/actions/blacklist'; export { doBlackListedOutpointsSubscribe } from 'redux/actions/blacklist';

View file

@ -318,6 +318,10 @@ export function doUserCheckIfEmailExists(email) {
data: { email }, data: { email },
}); });
dispatch({
type: ACTIONS.USER_EMAIL_NEW_EXISTS,
});
if (response.has_password) { if (response.has_password) {
dispatch({ dispatch({
type: ACTIONS.USER_PASSWORD_EXISTS, type: ACTIONS.USER_PASSWORD_EXISTS,
@ -509,7 +513,7 @@ export function doClearEmailEntry() {
}; };
} }
export function doClearPasswordEntries() { export function doClearPasswordEntry() {
return { return {
type: ACTIONS.USER_PASSWORD_SET_CLEAR, type: ACTIONS.USER_PASSWORD_SET_CLEAR,
}; };

View file

@ -152,14 +152,19 @@ reducers[ACTIONS.USER_EMAIL_NEW_FAILURE] = (state, action) =>
emailNewErrorMessage: action.data.error, emailNewErrorMessage: action.data.error,
}); });
reducers[ACTIONS.USER_EMAIL_NEW_CLEAR_ENTRY] = state => reducers[ACTIONS.USER_EMAIL_NEW_CLEAR_ENTRY] = state => {
Object.assign({}, state, { const newUser = { ...state.user };
delete newUser.primary_email;
return Object.assign({}, state, {
emailNewErrorMessage: null, emailNewErrorMessage: null,
emailAlreadyExists: false, emailAlreadyExists: false,
emailDoesNotExist: false, emailDoesNotExist: false,
passwordExistsForUser: false, passwordExistsForUser: false,
emailToVerify: null, emailToVerify: null,
user: newUser,
}); });
};
reducers[ACTIONS.USER_PASSWORD_SET_CLEAR] = state => reducers[ACTIONS.USER_PASSWORD_SET_CLEAR] = state =>
Object.assign({}, state, { Object.assign({}, state, {