diff --git a/app/assets/javascripts/discourse/controllers/create-account.js.es6 b/app/assets/javascripts/discourse/controllers/create-account.js.es6 index 7d846513b55..6352ade3092 100644 --- a/app/assets/javascripts/discourse/controllers/create-account.js.es6 +++ b/app/assets/javascripts/discourse/controllers/create-account.js.es6 @@ -20,6 +20,7 @@ export default DiscourseController.extend(ModalFunctionality, { canCreateLocal: Discourse.computed.setting('enable_local_logins'), showCreateForm: Em.computed.or('hasAuthOptions', 'canCreateLocal'), maxUsernameLength: Discourse.computed.setting('max_username_length'), + minUsernameLength: Discourse.computed.setting('min_username_length'), resetForm: function() { @@ -227,7 +228,7 @@ export default DiscourseController.extend(ModalFunctionality, { }.property('accountUsername'), shouldCheckUsernameMatch: function() { - return !this.blank('accountUsername') && this.get('accountUsername').length > 2; + return !this.blank('accountUsername') && this.get('accountUsername').length >= this.get('minUsernameLength'); }, checkUsernameAvailability: Discourse.debounce(function() { diff --git a/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 index d6df04ce190..c0bacaaa271 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 @@ -8,12 +8,13 @@ export default ObjectController.extend({ newUsername: null, maxLength: Discourse.computed.setting('max_username_length'), + minLength: Discourse.computed.setting('min_username_length'), newUsernameEmpty: Em.computed.empty('newUsername'), saveDisabled: Em.computed.or('saving', 'newUsernameEmpty', 'taken', 'unchanged', 'errorMessage'), unchanged: Discourse.computed.propertyEqual('newUsername', 'username'), checkTaken: function() { - if( this.get('newUsername') && this.get('newUsername').length < 3 ) { + if( this.get('newUsername') && this.get('newUsername').length < this.get('minLength') ) { this.set('errorMessage', I18n.t('user.name.too_short')); } else { var self = this;