mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-04-01 09:39:51 -04:00
FIX: don't make an ajax request when password or user is blank
This commit is contained in:
parent
ad1ae911f7
commit
24932009a5
1 changed files with 8 additions and 6 deletions
|
@ -45,9 +45,15 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
|
||||
actions: {
|
||||
login: function() {
|
||||
var self = this;
|
||||
|
||||
if(this.blank('loginName') || this.blank('loginPassword')){
|
||||
self.flash(I18n.t('login.blank_username_or_password'), 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
this.set('loggingIn', true);
|
||||
|
||||
var self = this;
|
||||
Discourse.ajax("/session", {
|
||||
data: { login: this.get('loginName'), password: this.get('loginPassword') },
|
||||
type: 'POST'
|
||||
|
@ -75,11 +81,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
|
||||
}, function() {
|
||||
// Failed to login
|
||||
if (self.blank('loginName') || self.blank('loginPassword')) {
|
||||
self.flash(I18n.t('login.blank_username_or_password'), 'error');
|
||||
} else {
|
||||
self.flash(I18n.t('login.error'), 'error');
|
||||
}
|
||||
self.flash(I18n.t('login.error'), 'error');
|
||||
self.set('loggingIn', false);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue