Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
30be85f
Reauthenticate WIP
magrinj Dec 16, 2019
3dc40d1
Fix call on wrong access point
magrinj Dec 20, 2019
3b0cb93
Fix some reauthenticate problems
magrinj Dec 23, 2019
8a01d9c
Add doc and fix types
magrinj Dec 23, 2019
21e22b0
Add typed db schema
vicrac Jan 7, 2020
32a168b
Add types for ordered
vicrac Jan 7, 2020
adcbcd2
chore(deps): bump stringstream
dependabot[bot] Jan 10, 2020
2d0355b
chore(deps): bump mixin-deep in /examples/complete/react-native
dependabot[bot] Jan 10, 2020
540dc29
chore(deps): bump lodash-es in /examples/complete/react-native-firebase
dependabot[bot] Jan 10, 2020
d779f3c
chore(deps): bump lodash in /examples/complete/react-native
dependabot[bot] Jan 10, 2020
2382c62
Fix stale profile listener
illuminist Jan 22, 2020
6636062
fix(auth): remove stale profile listener on empty auth state change -…
prescottprue Jan 23, 2020
19cc871
feat(types): add support for typed db schema - @vicrac - #826
prescottprue Jan 24, 2020
6bf011d
feat(auth): add reauthenticate method from firebase - @magrinj - #812
prescottprue Jan 24, 2020
9122f60
chore(deps): bump lodash from 4.17.11 to 4.17.15 in react-native exam…
prescottprue Jan 24, 2020
ff8f2ca
chore(deps): bump stringstream from 0.0.5 to 0.0.6 in react-native-fi…
prescottprue Jan 24, 2020
1d03e29
chore(deps): bump mixin-deep from 1.3.1 to 1.3.2 in react-native exam…
prescottprue Jan 24, 2020
d97fbfa
chore(deps): bump diff in /examples/complete/react-native-firebase
dependabot[bot] Jan 24, 2020
849094e
chore(deps): bump lodash-es from 4.17.4 to 4.17.15 in react-native-fi…
prescottprue Jan 24, 2020
0bbdc86
Merge branch 'master' into v3.1.0
Jan 24, 2020
f416be8
chore(deps): bump diff from 3.3.0 to 3.5.0 in react-native-firebase e…
prescottprue Jan 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix some reauthenticate problems
  • Loading branch information
magrinj committed Dec 23, 2019
commit 3b0cb937de7f57f046209f3c26f8db1ad516f7be
11 changes: 5 additions & 6 deletions src/actions/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ import { promisesForPopulate, getPopulateObjs } from '../utils/populate'

/**
* Dispatch login error action
*
* @param {Function} dispatch - Action dispatch function
* @param {object} authError - Error object
* @param {object} params - Supplement action params
* @returns {any} Return of action dispatch
* @private
*/
function dispatchLoginError(dispatch, authError) {
function dispatchLoginError(dispatch, authError, params = {}) {
return dispatch({
type: actionTypes.LOGIN_ERROR,
...params,
authError
})
}
Expand Down Expand Up @@ -596,10 +599,6 @@ export const login = (dispatch, firebase, credentials) => {
* @private
*/
export const reauthenticate = (dispatch, firebase, credentials) => {
if (firebase._.config.resetBeforeLogin) {
dispatchLoginError(dispatch, null)
}

const { method, params } = getReauthenticateMethodAndParams(
firebase,
credentials
Expand Down Expand Up @@ -643,7 +642,7 @@ export const reauthenticate = (dispatch, firebase, credentials) => {
).then(profile => ({ profile, ...userData }))
})
.catch(err => {
dispatchLoginError(dispatch, err)
dispatchLoginError(dispatch, err, { reauthenticate: true })
return Promise.reject(err)
})
}
Expand Down
4 changes: 4 additions & 0 deletions src/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ export function authReducer(
case LOGIN_ERROR:
case AUTH_EMPTY_CHANGE:
case LOGOUT:
// If it's reauthenticate keep user datas
if (action.reauthenticate) {
return preserveValuesFromState(state, true, {})
}
// Support keeping data when logging out
if (action.preserve && action.preserve.auth) {
return preserveValuesFromState(state, action.preserve.auth, {
Expand Down