1
0
Files
gringotts/gringotts-frontend/components/user/dialog-user-item.js

49 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
export function emailFormItem(name) {
return {
type: 'input-email',
name: name,
label: '邮箱',
placeholder: '请输入邮箱',
required: true,
clearable: true,
clearValueOnEmpty: true,
validateApi: '${base}/user/exists_username/${username}',
}
}
export function passwordFormItem(name, label = '密码') {
return {
type: 'input-password',
name: name,
label: label,
placeholder: `请输入${label}`,
required: true,
clearable: true,
clearValueOnEmpty: true,
validations: {
matchRegexp:
/^(?=.*\d)(?!.*(\d)\1{2})(?!.*(012|123|234|345|456|567|678|789|987|876|765|654|543|432|321|210))(?=.*[a-zA-Z])(?=.*[^\da-zA-Z\s]).{8,16}$/,
},
validationErrors: {
matchRegexp:
`${label}至少包含字母、数字、特殊字符8-16位并且不能连续出现3个大小连续或相同的数字`,
},
}
}
export function confirmPasswordFormItem(name, target, label = '密码') {
return {
type: 'input-password',
name: name,
label: `确认${label}`,
placeholder: `请再次输入${label}`,
required: true,
clearable: true,
validations: {
equalsField: target,
},
validationErrors: {
equalsField: `两次输入${label}不一致`,
},
}
}