Username change: check length in js, we don't need the server to do it

This commit is contained in:
Neil Lalonde 2013-03-18 15:28:12 -04:00
parent b6224b014c
commit c24f6d3d51

View File

@ -26,6 +26,9 @@ Discourse.PreferencesUsernameController = Discourse.ObjectController.extend({
}).property('newUsername', 'content.username'), }).property('newUsername', 'content.username'),
checkTaken: (function() { checkTaken: (function() {
if( this.get('newUsername') && this.get('newUsername').length < 3 ) {
this.set('errorMessage', Em.String.i18n('user.name.too_short'));
} else {
var _this = this; var _this = this;
this.set('taken', false); this.set('taken', false);
this.set('errorMessage', null); this.set('errorMessage', null);
@ -38,6 +41,7 @@ Discourse.PreferencesUsernameController = Discourse.ObjectController.extend({
return _this.set('taken', true); return _this.set('taken', true);
} }
}); });
}
}).observes('newUsername'), }).observes('newUsername'),
saveButtonText: (function() { saveButtonText: (function() {