mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: don't make an ajax request when password or user is blank
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user