mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Enforce max username length on client
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
<tr>
|
||||
<td><label for='new-account-username'>{{i18n user.username.title}}</label></td>
|
||||
<td>
|
||||
{{view Ember.TextField valueBinding="view.accountUsername" id="new-account-username"}}
|
||||
{{view Ember.TextField valueBinding="view.accountUsername" id="new-account-username" maxlength="15"}}
|
||||
{{view Discourse.InputTipView validationBinding="view.usernameValidation"}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{i18n user.username.title}}</label>
|
||||
<div class="controls">
|
||||
{{view Ember.TextField valueBinding="controller.newUsername" elementId="change_username" classNames="input-xxlarge"}}
|
||||
{{view Ember.TextField valueBinding="controller.newUsername" elementId="change_username" classNames="input-xxlarge" maxlength="15"}}
|
||||
</div>
|
||||
<div class='instructions'>
|
||||
{{#if controller.taken}}
|
||||
|
||||
@@ -69,6 +69,9 @@ window.Discourse.CreateAccountView = window.Discourse.ModalBodyView.extend Disco
|
||||
# If too short
|
||||
return Discourse.InputValidation.create(failed: true, reason: Em.String.i18n('user.username.too_short')) if @get('accountUsername').length < 3
|
||||
|
||||
# If too long
|
||||
return Discourse.InputValidation.create(failed: true, reason: Em.String.i18n('user.username.too_long')) if @get('accountUsername').length > 15
|
||||
|
||||
@checkUsernameAvailability()
|
||||
|
||||
# Let's check it out asynchronously
|
||||
|
||||
Reference in New Issue
Block a user