changes ChangeUsername

This commit is contained in:
Belen Curcio
2017-11-22 00:53:01 -03:00
parent 90daab8219
commit f19d6b6800
2 changed files with 4 additions and 3 deletions
@@ -323,7 +323,7 @@ export const checkLogin = () => (dispatch, _, {rest, client, pym, storage}) => {
pym.sendMessage('coral-auth-changed', JSON.stringify(result.user));
// Display create username dialog if necessary.
if (can(result.user, 'EDIT_NAME') && get(result.user, 'status.banned.status')) {
if (can(result.user, 'EDIT_NAME') && !get(result.user, 'status.banned.status')) {
dispatch(showCreateUsernameDialog());
}
})
@@ -92,12 +92,13 @@ class ChangeUsernameContainer extends React.Component {
handleSubmitUsername = (e) => {
e.preventDefault();
const {errors, formData: {username}} = this.state;
const {validForm, invalidForm} = this.props;
const {validForm, invalidForm, hideCreateUsernameDialog, changeUsername} = this.props;
this.displayErrors();
if (this.isCompleted() && !Object.keys(errors).length) {
this.props.changeUsername(this.props.auth.user.id, username);
changeUsername(this.props.auth.user.id, username);
validForm();
hideCreateUsernameDialog();
} else {
invalidForm(t('createdisplay.check_the_form'));
}