Disable submit button on signup form when you've submitted the form
This commit is contained in:
parent
052887c296
commit
1133d90dcc
|
@ -14,14 +14,16 @@ Discourse.CreateAccountView = Discourse.ModalBodyView.extend({
|
||||||
complete: false,
|
complete: false,
|
||||||
accountPasswordConfirm: 0,
|
accountPasswordConfirm: 0,
|
||||||
accountChallenge: 0,
|
accountChallenge: 0,
|
||||||
|
formSubmitted: false,
|
||||||
|
|
||||||
submitDisabled: (function() {
|
submitDisabled: (function() {
|
||||||
|
if (this.get('formSubmitted')) return true;
|
||||||
if (this.get('nameValidation.failed')) return true;
|
if (this.get('nameValidation.failed')) return true;
|
||||||
if (this.get('emailValidation.failed')) return true;
|
if (this.get('emailValidation.failed')) return true;
|
||||||
if (this.get('usernameValidation.failed')) return true;
|
if (this.get('usernameValidation.failed')) return true;
|
||||||
if (this.get('passwordValidation.failed')) return true;
|
if (this.get('passwordValidation.failed')) return true;
|
||||||
return false;
|
return false;
|
||||||
}).property('nameValidation.failed', 'emailValidation.failed', 'usernameValidation.failed', 'passwordValidation.failed'),
|
}).property('nameValidation.failed', 'emailValidation.failed', 'usernameValidation.failed', 'passwordValidation.failed', 'formSubmitted'),
|
||||||
|
|
||||||
passwordRequired: (function() {
|
passwordRequired: (function() {
|
||||||
return this.blank('authOptions.auth_provider');
|
return this.blank('authOptions.auth_provider');
|
||||||
|
@ -252,6 +254,7 @@ Discourse.CreateAccountView = Discourse.ModalBodyView.extend({
|
||||||
createAccount: function() {
|
createAccount: function() {
|
||||||
var challenge, email, name, password, passwordConfirm, username,
|
var challenge, email, name, password, passwordConfirm, username,
|
||||||
_this = this;
|
_this = this;
|
||||||
|
this.set('formSubmitted', true);
|
||||||
name = this.get('accountName');
|
name = this.get('accountName');
|
||||||
email = this.get('accountEmail');
|
email = this.get('accountEmail');
|
||||||
password = this.get('accountPassword');
|
password = this.get('accountPassword');
|
||||||
|
@ -264,11 +267,13 @@ Discourse.CreateAccountView = Discourse.ModalBodyView.extend({
|
||||||
_this.set('complete', true);
|
_this.set('complete', true);
|
||||||
} else {
|
} else {
|
||||||
_this.flash(result.message, 'error');
|
_this.flash(result.message, 'error');
|
||||||
|
_this.set('formSubmitted', false);
|
||||||
}
|
}
|
||||||
if (result.active) {
|
if (result.active) {
|
||||||
return window.location.reload();
|
return window.location.reload();
|
||||||
}
|
}
|
||||||
}, function() {
|
}, function() {
|
||||||
|
_this.set('formSubmitted', false);
|
||||||
return _this.flash(Em.String.i18n('create_account.failed'), 'error');
|
return _this.flash(Em.String.i18n('create_account.failed'), 'error');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue