Other small changes and fix bug because displayname instead displayName...

This commit is contained in:
gaba
2017-02-16 16:07:19 -08:00
parent 3166692d4e
commit 4765973a58
5 changed files with 12 additions and 14 deletions
+3 -3
View File
@@ -12,8 +12,8 @@ export const createUsernameRequest = () => ({type: actions.CREATE_USERNAME_REQUE
export const showCreateUsernameDialog = () => ({type: actions.SHOW_CREATEUSERNAME_DIALOG});
export const hideCreateUsernameDialog = () => ({type: actions.HIDE_CREATEUSERNAME_DIALOG});
const createUsernameSuccess = () => ({type: actions.CREATEUSERNAME_SUCCESS});
const createUsernameFailure = error => ({type: actions.CREATEUSERNAME_FAILURE, error});
const createUsernameSuccess = () => ({type: actions.CREATE_USERNAME_SUCCESS});
const createUsernameFailure = error => ({type: actions.CREATE_USERNAME_FAILURE, error});
export const updateUsername = ({username}) => ({type: actions.UPDATE_USERNAME, username});
@@ -95,7 +95,7 @@ export const fetchSignUpFacebook = () => dispatch => {
export const facebookCallback = (err, data) => dispatch => {
if (err) {
signInFacebookFailure(err);
dispatch(signInFacebookFailure(err));
return;
}
try {
+2 -2
View File
@@ -5,8 +5,8 @@ export const SHOW_SIGNIN_DIALOG = 'SHOW_SIGNIN_DIALOG';
export const HIDE_SIGNIN_DIALOG = 'HIDE_SIGNIN_DIALOG';
export const CREATE_USERNAME_REQUEST = 'CREATE_USERNAME_REQUEST';
export const CREATEUSERNAME_SUCCESS = 'CREATEUSERNAME_SUCCESS';
export const CREATEUSERNAME_FAILURE = 'CREATEUSERNAME_FAILURE';
export const CREATE_USERNAME_SUCCESS = 'CREATE_USERNAME_SUCCESS';
export const CREATE_USERNAME_FAILURE = 'CREATE_USERNAME_FAILURE';
export const CREATE_USERNAME = 'CREATE_USERNAME';
export const SHOW_CREATEUSERNAME_DIALOG = 'SHOW_CREATEUSERNAME_DIALOG';
export const HIDE_CREATEUSERNAME_DIALOG = 'HIDE_CREATEUSERNAME_DIALOG';
+2 -2
View File
@@ -50,12 +50,12 @@ export default function auth (state = initialState, action) {
return state.merge(Map({
showCreateUsernameDialog: false
}));
case actions.CREATEUSERNAME_SUCCESS :
case actions.CREATE_USERNAME_SUCCESS :
return state.merge(Map({
showCreateUsernameDialog: false,
error: ''
}));
case actions.CREATEUSERNAME_FAILURE :
case actions.CREATE_USERNAME_FAILURE :
return state
.set('error', action.error);
case actions.CHANGE_VIEW :
-2
View File
@@ -103,8 +103,6 @@ if (process.env.TALK_FACEBOOK_APP_ID && process.env.TALK_FACEBOOK_APP_SECRET &&
clientSecret: process.env.TALK_FACEBOOK_APP_SECRET,
callbackURL: `${process.env.TALK_ROOT_URL}/api/v1/auth/facebook/callback`,
// TODO: remove displayName reference when we have steps in the FE to handle
// the username create flow.
profileFields: ['id', 'displayName', 'picture.type(large)']
}, (accessToken, refreshToken, profile, done) => {
UsersService
+5 -5
View File
@@ -109,7 +109,7 @@ module.exports = class UsersService {
* @param {Object} profile - User social/external profile
* @param {Function} done [description]
*/
static findOrCreateExternalUser({id, provider, displayname}) {
static findOrCreateExternalUser({id, provider, displayName}) {
return UserModel
.findOne({
profiles: {
@@ -123,8 +123,8 @@ module.exports = class UsersService {
if (user) {
return user;
}
let username = UsersService.castUsername(displayname);
let username = UsersService.castUsername(displayName);
// The user was not found, lets create them!
user = new UserModel({
@@ -220,14 +220,14 @@ module.exports = class UsersService {
* @param {String} username name of the display user
* @param {Function} done callback
*/
static createLocalUser(email, password, username) {
static createLocalUser(email, password, displayname) {
if (!email) {
return Promise.reject(errors.ErrMissingEmail);
}
email = email.toLowerCase().trim();
username = username.trim();
let username = displayname.trim();
return Promise.all([
UsersService.isValidUsername(username),