FIX: deprecation warning in create_account_controller.js. Need to move createAccount into actions.
This commit is contained in:
parent
7fa07f3401
commit
24d81e2364
|
@ -295,33 +295,34 @@ Discourse.CreateAccountController = Discourse.Controller.extend(Discourse.ModalF
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
createAccount: function() {
|
actions: {
|
||||||
var createAccountController = this;
|
createAccount: function() {
|
||||||
this.set('formSubmitted', true);
|
var createAccountController = this;
|
||||||
var name = this.get('accountName');
|
this.set('formSubmitted', true);
|
||||||
var email = this.get('accountEmail');
|
var name = this.get('accountName');
|
||||||
var password = this.get('accountPassword');
|
var email = this.get('accountEmail');
|
||||||
var username = this.get('accountUsername');
|
var password = this.get('accountPassword');
|
||||||
var passwordConfirm = this.get('accountPasswordConfirm');
|
var username = this.get('accountUsername');
|
||||||
var challenge = this.get('accountChallenge');
|
var passwordConfirm = this.get('accountPasswordConfirm');
|
||||||
return Discourse.User.createAccount(name, email, password, username, passwordConfirm, challenge).then(function(result) {
|
var challenge = this.get('accountChallenge');
|
||||||
if (result.success) {
|
return Discourse.User.createAccount(name, email, password, username, passwordConfirm, challenge).then(function(result) {
|
||||||
createAccountController.flash(result.message);
|
if (result.success) {
|
||||||
createAccountController.set('complete', true);
|
createAccountController.flash(result.message);
|
||||||
} else {
|
createAccountController.set('complete', true);
|
||||||
createAccountController.flash(result.message || I18n.t('create_account.failed'), 'error');
|
} else {
|
||||||
if (result.errors && result.errors.email && result.values) {
|
createAccountController.flash(result.message || I18n.t('create_account.failed'), 'error');
|
||||||
createAccountController.get('rejectedEmails').pushObject(result.values.email);
|
if (result.errors && result.errors.email && result.values) {
|
||||||
|
createAccountController.get('rejectedEmails').pushObject(result.values.email);
|
||||||
|
}
|
||||||
|
createAccountController.set('formSubmitted', false);
|
||||||
}
|
}
|
||||||
|
if (result.active) {
|
||||||
|
return window.location.reload();
|
||||||
|
}
|
||||||
|
}, function() {
|
||||||
createAccountController.set('formSubmitted', false);
|
createAccountController.set('formSubmitted', false);
|
||||||
}
|
return createAccountController.flash(I18n.t('create_account.failed'), 'error');
|
||||||
if (result.active) {
|
});
|
||||||
return window.location.reload();
|
}
|
||||||
}
|
|
||||||
}, function() {
|
|
||||||
createAccountController.set('formSubmitted', false);
|
|
||||||
return createAccountController.flash(I18n.t('create_account.failed'), 'error');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue