Enforce max username length on client
This commit is contained in:
parent
24cf672c7d
commit
d1a04fa06a
|
@ -30,7 +30,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td><label for='new-account-username'>{{i18n user.username.title}}</label></td>
|
<td><label for='new-account-username'>{{i18n user.username.title}}</label></td>
|
||||||
<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"}}
|
{{view Discourse.InputTipView validationBinding="view.usernameValidation"}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label">{{i18n user.username.title}}</label>
|
<label class="control-label">{{i18n user.username.title}}</label>
|
||||||
<div class="controls">
|
<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>
|
||||||
<div class='instructions'>
|
<div class='instructions'>
|
||||||
{{#if controller.taken}}
|
{{#if controller.taken}}
|
||||||
|
|
|
@ -69,6 +69,9 @@ window.Discourse.CreateAccountView = window.Discourse.ModalBodyView.extend Disco
|
||||||
# If too short
|
# If too short
|
||||||
return Discourse.InputValidation.create(failed: true, reason: Em.String.i18n('user.username.too_short')) if @get('accountUsername').length < 3
|
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()
|
@checkUsernameAvailability()
|
||||||
|
|
||||||
# Let's check it out asynchronously
|
# Let's check it out asynchronously
|
||||||
|
|
|
@ -504,6 +504,7 @@ en:
|
||||||
global_mismatch: "Already registered. Try {{suggestion}}?"
|
global_mismatch: "Already registered. Try {{suggestion}}?"
|
||||||
not_available: "Not available. Try {{suggestion}}?"
|
not_available: "Not available. Try {{suggestion}}?"
|
||||||
too_short: "Your username is too short."
|
too_short: "Your username is too short."
|
||||||
|
too_long: "Your username is too long."
|
||||||
checking: "Checking username availability..."
|
checking: "Checking username availability..."
|
||||||
enter_email: 'Username found. Enter matching email.'
|
enter_email: 'Username found. Enter matching email.'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue