fe6acc90e4
* added account page showing username and email * change username and email * validate current password and add new password * reject promise with error for reduxForm submit-validation for current password * updated user reducer to handle setting sucess and server side async * warning if there is current password but no new password * fixes logout button * import validate function, fixes logout style
29 lines
902 B
JavaScript
29 lines
902 B
JavaScript
import * as ActionTypes from '../../constants';
|
|
|
|
const user = (state = { authenticated: false }, action) => {
|
|
switch (action.type) {
|
|
case ActionTypes.AUTH_USER:
|
|
return { ...action.user,
|
|
authenticated: true };
|
|
case ActionTypes.UNAUTH_USER:
|
|
return {
|
|
authenticated: false
|
|
};
|
|
case ActionTypes.AUTH_ERROR:
|
|
return {
|
|
authenticated: false
|
|
};
|
|
case ActionTypes.RESET_PASSWORD_INITIATE:
|
|
return Object.assign({}, state, { resetPasswordInitiate: true });
|
|
case ActionTypes.RESET_PASSWORD_RESET:
|
|
return Object.assign({}, state, { resetPasswordInitiate: false });
|
|
case ActionTypes.INVALID_RESET_PASSWORD_TOKEN:
|
|
return Object.assign({}, state, { resetPasswordInvalid: true });
|
|
case ActionTypes.SETTINGS_UPDATED:
|
|
return { ...state, ...action.user };
|
|
default:
|
|
return state;
|
|
}
|
|
};
|
|
|
|
export default user;
|