diff --git a/client/coral-embed-stream/src/index.js b/client/coral-embed-stream/src/index.js index 0306079f3..66ed9ad56 100644 --- a/client/coral-embed-stream/src/index.js +++ b/client/coral-embed-stream/src/index.js @@ -8,16 +8,14 @@ import './graphql'; import {addExternalConfig} from 'coral-embed-stream/src/actions/config'; import reducers from './reducers'; -import localStore, {injectReducers} from 'coral-framework/services/store'; +import store, {injectReducers} from 'coral-framework/services/store'; import AppRouter from './AppRouter'; import {pym} from 'coral-framework'; injectReducers(reducers); -const store = (window.opener && window.opener.coralStore) ? window.opener.coralStore : localStore; - // Don't run this in the popup. -if (store === localStore) { +if (!window.opener) { store.dispatch(checkLogin()); pym.sendMessage('getConfig'); diff --git a/client/coral-framework/actions/auth.js b/client/coral-framework/actions/auth.js index f0827ca73..c4d6d782e 100644 --- a/client/coral-framework/actions/auth.js +++ b/client/coral-framework/actions/auth.js @@ -192,7 +192,7 @@ export const fetchSignUpFacebook = () => (dispatch) => { ); }; -export const facebookCallback = (err, data) => (dispatch, getState) => { +export const facebookCallback = (err, data) => (dispatch) => { if (err) { dispatch(signInFacebookFailure(err)); return; @@ -201,10 +201,6 @@ export const facebookCallback = (err, data) => (dispatch, getState) => { dispatch(handleAuthToken(data.token)); dispatch(signInFacebookSuccess(data.user)); dispatch(hideSignInDialog()); - const {user: {canEditName, status}} = getState().auth.toJS(); - if (canEditName && status !== 'BANNED') { - dispatch(showCreateUsernameDialog()); - } } catch (err) { dispatch(signInFacebookFailure(err)); return; @@ -306,6 +302,11 @@ export const checkLogin = () => (dispatch) => { } dispatch(checkLoginSuccess(result.user)); + + // Display create username dialog if necessary. + if (result.user.canEditName && result.user.status !== 'BANNED') { + dispatch(showCreateUsernameDialog()); + } }) .catch((error) => { console.error(error); diff --git a/plugins/coral-plugin-auth/client/components/ChangeUsername.js b/plugins/coral-plugin-auth/client/components/ChangeUsername.js index 5b5a54510..761fe786d 100644 --- a/plugins/coral-plugin-auth/client/components/ChangeUsername.js +++ b/plugins/coral-plugin-auth/client/components/ChangeUsername.js @@ -100,7 +100,7 @@ class ChangeUsernameContainer extends React.Component { return (