Extend password validation length.

This commit is contained in:
kunw 2016-10-14 18:02:13 +08:00
parent d0d6a8418b
commit 9bf08f368c
4 changed files with 8 additions and 8 deletions

View File

@ -321,7 +321,7 @@ func validate(user models.User) error {
if isContainIllegalChar(user.Username, []string{",", "~", "#", "$", "%"}) {
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.")
}
if err := commonValidate(user); err != nil {

View File

@ -19,6 +19,6 @@
angular
.module('harbor.validator')
.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])*)*$/);
})();

View File

@ -52,9 +52,9 @@ var locale_messages = {
'full_name_is_too_long': 'Full name is too long. (maximum 20 characters)',
'full_name_contains_illegal_chars': 'Full name contains illegal character(s).',
'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_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',
'password_does_not_match': 'Passwords do 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': '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',
'username_already_exist': 'Username already exist.',
'username_does_not_exist': 'Username does not exist.',

View File

@ -52,9 +52,9 @@ var locale_messages = {
'full_name_is_too_long' : '全名长度超出限制。最长为20个字符',
'full_name_contains_illegal_chars' : '全名包含不合法的字符。',
'password': '密码',
'password_desc': '至少输入 7个字符且包含 1个小写字母 1个大写字母和 1个数字。',
'password_desc': '至少输入 8个字符且包含 1个小写字母 1个大写字母和 1个数字。',
'password_is_required' : '密码为必填项。',
'password_is_invalid' : '密码无效。至少输入 7个字符且包含 1个小写字母1个大写字母和 1个数字。',
'password_is_invalid' : '密码无效。至少输入 8个字符且包含 1个小写字母1个大写字母和 1个数字。',
'confirm_password': '确认密码',
'password_does_not_match' : '两次密码输入不一致。',
'comments': '备注',
@ -119,7 +119,7 @@ var locale_messages = {
'old_password_is_required': '原密码为必填项。',
'old_password_is_incorrect': '原密码不正确。',
'new_password_is_required': '新密码为必填项。',
'new_password_is_invalid': '新密码无效。至少输入 7个字符且包含 1个小写字母1个大写字母和 1个数字。',
'new_password_is_invalid': '新密码无效。至少输入 8个字符且包含 1个小写字母1个大写字母和 1个数字。',
'new_password': '新密码',
'username_already_exist': '用户名已存在。',
'username_does_not_exist': '用户名不存在。',