mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
Disable submit button on signup form when you've submitted the form
This commit is contained in:
parent
052887c296
commit
1133d90dcc
1 changed files with 6 additions and 1 deletions
|
@ -14,14 +14,16 @@ Discourse.CreateAccountView = Discourse.ModalBodyView.extend({
|
|||
complete: false,
|
||||
accountPasswordConfirm: 0,
|
||||
accountChallenge: 0,
|
||||
formSubmitted: false,
|
||||
|
||||
submitDisabled: (function() {
|
||||
if (this.get('formSubmitted')) return true;
|
||||
if (this.get('nameValidation.failed')) return true;
|
||||
if (this.get('emailValidation.failed')) return true;
|
||||
if (this.get('usernameValidation.failed')) return true;
|
||||
if (this.get('passwordValidation.failed')) return true;
|
||||
return false;
|
||||
}).property('nameValidation.failed', 'emailValidation.failed', 'usernameValidation.failed', 'passwordValidation.failed'),
|
||||
}).property('nameValidation.failed', 'emailValidation.failed', 'usernameValidation.failed', 'passwordValidation.failed', 'formSubmitted'),
|
||||
|
||||
passwordRequired: (function() {
|
||||
return this.blank('authOptions.auth_provider');
|
||||
|
@ -252,6 +254,7 @@ Discourse.CreateAccountView = Discourse.ModalBodyView.extend({
|
|||
createAccount: function() {
|
||||
var challenge, email, name, password, passwordConfirm, username,
|
||||
_this = this;
|
||||
this.set('formSubmitted', true);
|
||||
name = this.get('accountName');
|
||||
email = this.get('accountEmail');
|
||||
password = this.get('accountPassword');
|
||||
|
@ -264,11 +267,13 @@ Discourse.CreateAccountView = Discourse.ModalBodyView.extend({
|
|||
_this.set('complete', true);
|
||||
} else {
|
||||
_this.flash(result.message, 'error');
|
||||
_this.set('formSubmitted', false);
|
||||
}
|
||||
if (result.active) {
|
||||
return window.location.reload();
|
||||
}
|
||||
}, function() {
|
||||
_this.set('formSubmitted', false);
|
||||
return _this.flash(Em.String.i18n('create_account.failed'), 'error');
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue