FEATURE: Hidden site setting for max username length

This commit is contained in:
Sam 2014-04-14 12:55:33 +10:00
parent d3810ba3bc
commit b0ed9082b3
3 changed files with 6 additions and 2 deletions

View File

@ -18,7 +18,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">
{{textField value=newUsername id="change_username" classNames="input-xxlarge" maxlength="15"}} {{textField value=newUsername id="change_username" classNames="input-xxlarge" maxlengthBinding="Discourse.SiteSettings.max_username_length"}}
</div> </div>
<div class='instructions'> <div class='instructions'>
{{#if taken}} {{#if taken}}

View File

@ -102,7 +102,7 @@ class User < ActiveRecord::Base
if SiteSetting.enforce_global_nicknames if SiteSetting.enforce_global_nicknames
GLOBAL_USERNAME_LENGTH_RANGE GLOBAL_USERNAME_LENGTH_RANGE
else else
SiteSetting.min_username_length.to_i..GLOBAL_USERNAME_LENGTH_RANGE.end SiteSetting.min_username_length.to_i..SiteSetting.max_username_length.to_i
end end
end end

View File

@ -103,6 +103,10 @@ users:
min_username_length: min_username_length:
client: true client: true
default: 3 default: 3
max_username_length:
client: true
default: 15
hidden: true
min_password_length: min_password_length:
client: true client: true
default: 8 default: 8