Support longer UserName

Signed-off-by: peimingming <peimingming@corp.netease.com>
This commit is contained in:
peimingming 2018-10-26 17:07:36 +08:00
parent b2b411ce1c
commit d3a617efd6
4 changed files with 4 additions and 4 deletions

View File

@ -353,7 +353,7 @@ func (ua *UserAPI) modifiable() bool {
// validate only validate when user register
func validate(user models.User) error {
if isIllegalLength(user.Username, 1, 20) {
if isIllegalLength(user.Username, 1, 255) {
return fmt.Errorf("username with illegal length")
}
if isContainIllegalChar(user.Username, []string{",", "~", "#", "$", "%"}) {

View File

@ -4,7 +4,7 @@
<div class="form-group form-group-override">
<label for="username" class="required form-group-label-override">{{'PROFILE.USER_NAME' | translate}}</label>
<label for="username" aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left" [class.invalid]='getValidationState("username")'>
<input type="text" required pattern='[^"~#$%]+' maxLengthExt="255" #usernameInput="ngModel" name="username" [(ngModel)]="newUser.username" id="username" size="30"
<input type="text" required pattern='[^"~#$%]+' maxLengthExt="80" #usernameInput="ngModel" name="username" [(ngModel)]="newUser.username" id="username" size="30"
(input)='handleValidation("username", false)'
(blur)='handleValidation("username", true)'>
<span class="tooltip-content">

View File

@ -51,7 +51,7 @@
},
"TOOLTIP": {
"EMAIL": "Email should be a valid email address like name@example.com.",
"USER_NAME": "Cannot contain special characters and maximum length should be 20 characters.",
"USER_NAME": "Cannot contain special characters and maximum length should be 80 characters.",
"FULL_NAME": "Maximum length should be 20 characters.",
"COMMENT": "Length of comment should be less than 20 characters.",
"CURRENT_PWD": "Current password is required.",

View File

@ -51,7 +51,7 @@
},
"TOOLTIP": {
"EMAIL": "请使用正确的邮箱地址比如name@example.com。",
"USER_NAME": "不能包含特殊字符且长度不能超过20。",
"USER_NAME": "不能包含特殊字符且长度不能超过80。",
"FULL_NAME": "长度不能超过20。",
"COMMENT": "长度不能超过20。",
"CURRENT_PWD": "当前密码为必填项。",