mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-30 12:38:17 +01:00
Merge pull request #886 from wknet123/dev
Extend password validation length.
This commit is contained in:
commit
c0fdec3a1a
@ -321,7 +321,7 @@ func validate(user models.User) error {
|
|||||||
if isContainIllegalChar(user.Username, []string{",", "~", "#", "$", "%"}) {
|
if isContainIllegalChar(user.Username, []string{",", "~", "#", "$", "%"}) {
|
||||||
return fmt.Errorf("Username contains illegal characters.")
|
return fmt.Errorf("Username contains illegal characters.")
|
||||||
}
|
}
|
||||||
if isIllegalLength(user.Password, 7, 20) {
|
if isIllegalLength(user.Password, 8, 20) {
|
||||||
return fmt.Errorf("Password with illegal length.")
|
return fmt.Errorf("Password with illegal length.")
|
||||||
}
|
}
|
||||||
if err := commonValidate(user); err != nil {
|
if err := commonValidate(user); err != nil {
|
||||||
|
@ -19,6 +19,6 @@
|
|||||||
angular
|
angular
|
||||||
.module('harbor.validator')
|
.module('harbor.validator')
|
||||||
.constant('INVALID_CHARS', [",","~","#", "$", "%"])
|
.constant('INVALID_CHARS', [",","~","#", "$", "%"])
|
||||||
.constant('PASSWORD_REGEXP', /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{7,20}$/)
|
.constant('PASSWORD_REGEXP', /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{8,20}$/)
|
||||||
.constant('PROJECT_REGEXP', /^[a-z0-9](?:-*[a-z0-9])*(?:[._][a-z0-9](?:-*[a-z0-9])*)*$/);
|
.constant('PROJECT_REGEXP', /^[a-z0-9](?:-*[a-z0-9])*(?:[._][a-z0-9](?:-*[a-z0-9])*)*$/);
|
||||||
})();
|
})();
|
@ -52,9 +52,9 @@ var locale_messages = {
|
|||||||
'full_name_is_too_long': 'Full name is too long. (maximum 20 characters)',
|
'full_name_is_too_long': 'Full name is too long. (maximum 20 characters)',
|
||||||
'full_name_contains_illegal_chars': 'Full name contains illegal character(s).',
|
'full_name_contains_illegal_chars': 'Full name contains illegal character(s).',
|
||||||
'password': 'Password',
|
'password': 'Password',
|
||||||
'password_desc': 'At least 7 characters with 1 lowercase letter, 1 capital letter and 1 numeric character.',
|
'password_desc': 'At least 8 characters with 1 lowercase letter, 1 capital letter and 1 numeric character.',
|
||||||
'password_is_required': 'Password is required.',
|
'password_is_required': 'Password is required.',
|
||||||
'password_is_invalid': 'Password is invalid. At least 7 characters with 1 lowercase letter, 1 capital letter and 1 numeric character.',
|
'password_is_invalid': 'Password is invalid. At least 8 characters with 1 lowercase letter, 1 capital letter and 1 numeric character.',
|
||||||
'confirm_password': 'Confirm Password',
|
'confirm_password': 'Confirm Password',
|
||||||
'password_does_not_match': 'Passwords do not match.',
|
'password_does_not_match': 'Passwords do not match.',
|
||||||
'comments': 'Comments',
|
'comments': 'Comments',
|
||||||
@ -119,7 +119,7 @@ var locale_messages = {
|
|||||||
'old_password_is_required': 'Old password is required.',
|
'old_password_is_required': 'Old password is required.',
|
||||||
'old_password_is_incorrect': 'Old password is incorrect.',
|
'old_password_is_incorrect': 'Old password is incorrect.',
|
||||||
'new_password_is_required': 'New password is required.',
|
'new_password_is_required': 'New password is required.',
|
||||||
'new_password_is_invalid': 'New password is invalid. At least 7 characters with 1 lowercase letter, 1 capital letter and 1 numeric character.',
|
'new_password_is_invalid': 'New password is invalid. At least 8 characters with 1 lowercase letter, 1 capital letter and 1 numeric character.',
|
||||||
'new_password': 'New Password',
|
'new_password': 'New Password',
|
||||||
'username_already_exist': 'Username already exist.',
|
'username_already_exist': 'Username already exist.',
|
||||||
'username_does_not_exist': 'Username does not exist.',
|
'username_does_not_exist': 'Username does not exist.',
|
||||||
|
@ -52,9 +52,9 @@ var locale_messages = {
|
|||||||
'full_name_is_too_long' : '全名长度超出限制。(最长为20个字符)',
|
'full_name_is_too_long' : '全名长度超出限制。(最长为20个字符)',
|
||||||
'full_name_contains_illegal_chars' : '全名包含不合法的字符。',
|
'full_name_contains_illegal_chars' : '全名包含不合法的字符。',
|
||||||
'password': '密码',
|
'password': '密码',
|
||||||
'password_desc': '至少输入 7个字符且包含 1个小写字母, 1个大写字母和 1个数字。',
|
'password_desc': '至少输入 8个字符且包含 1个小写字母, 1个大写字母和 1个数字。',
|
||||||
'password_is_required' : '密码为必填项。',
|
'password_is_required' : '密码为必填项。',
|
||||||
'password_is_invalid' : '密码无效。至少输入 7个字符且包含 1个小写字母,1个大写字母和 1个数字。',
|
'password_is_invalid' : '密码无效。至少输入 8个字符且包含 1个小写字母,1个大写字母和 1个数字。',
|
||||||
'confirm_password': '确认密码',
|
'confirm_password': '确认密码',
|
||||||
'password_does_not_match' : '两次密码输入不一致。',
|
'password_does_not_match' : '两次密码输入不一致。',
|
||||||
'comments': '备注',
|
'comments': '备注',
|
||||||
@ -119,7 +119,7 @@ var locale_messages = {
|
|||||||
'old_password_is_required': '原密码为必填项。',
|
'old_password_is_required': '原密码为必填项。',
|
||||||
'old_password_is_incorrect': '原密码不正确。',
|
'old_password_is_incorrect': '原密码不正确。',
|
||||||
'new_password_is_required': '新密码为必填项。',
|
'new_password_is_required': '新密码为必填项。',
|
||||||
'new_password_is_invalid': '新密码无效。至少输入 7个字符且包含 1个小写字母,1个大写字母和 1个数字。',
|
'new_password_is_invalid': '新密码无效。至少输入 8个字符且包含 1个小写字母,1个大写字母和 1个数字。',
|
||||||
'new_password': '新密码',
|
'new_password': '新密码',
|
||||||
'username_already_exist': '用户名已存在。',
|
'username_already_exist': '用户名已存在。',
|
||||||
'username_does_not_exist': '用户名不存在。',
|
'username_does_not_exist': '用户名不存在。',
|
||||||
|
Loading…
Reference in New Issue
Block a user