mirror of https://gitee.com/answerdev/answer.git
fix: username verification format #181
This commit is contained in:
parent
ace2e72e77
commit
bdaf254af1
|
@ -618,6 +618,7 @@ ui:
|
||||||
msg:
|
msg:
|
||||||
empty: Name cannot be empty.
|
empty: Name cannot be empty.
|
||||||
range: Name up to 30 characters.
|
range: Name up to 30 characters.
|
||||||
|
character: 'Must use the character set "a-z", "0-9", " - . _"'
|
||||||
email:
|
email:
|
||||||
label: Email
|
label: Email
|
||||||
msg:
|
msg:
|
||||||
|
@ -981,6 +982,7 @@ ui:
|
||||||
admin_name:
|
admin_name:
|
||||||
label: Name
|
label: Name
|
||||||
msg: Name cannot be empty.
|
msg: Name cannot be empty.
|
||||||
|
character: 'Must use the character set "a-z", "0-9", " - . _"'
|
||||||
admin_password:
|
admin_password:
|
||||||
label: Password
|
label: Password
|
||||||
text: >-
|
text: >-
|
||||||
|
|
|
@ -71,6 +71,13 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
|
||||||
isInvalid: true,
|
isInvalid: true,
|
||||||
errorMsg: t('admin_name.msg'),
|
errorMsg: t('admin_name.msg'),
|
||||||
};
|
};
|
||||||
|
} else if (/[^a-z0-9\-._]/.test(name.value)) {
|
||||||
|
bol = false;
|
||||||
|
data.name = {
|
||||||
|
value: name.value,
|
||||||
|
isInvalid: true,
|
||||||
|
errorMsg: t('admin_name.character'),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!password.value) {
|
if (!password.value) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import {
|
||||||
|
|
||||||
const Index: FC = () => {
|
const Index: FC = () => {
|
||||||
const { t } = useTranslation('translation', { keyPrefix: 'install' });
|
const { t } = useTranslation('translation', { keyPrefix: 'install' });
|
||||||
const [step, setStep] = useState(1);
|
const [step, setStep] = useState(4);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [errorData, setErrorData] = useState<{ [propName: string]: any }>({
|
const [errorData, setErrorData] = useState<{ [propName: string]: any }>({
|
||||||
msg: '',
|
msg: '',
|
||||||
|
|
|
@ -70,6 +70,13 @@ const Index: React.FC<Props> = ({ callback }) => {
|
||||||
isInvalid: true,
|
isInvalid: true,
|
||||||
errorMsg: t('name.msg.empty'),
|
errorMsg: t('name.msg.empty'),
|
||||||
};
|
};
|
||||||
|
} else if (/[^a-z0-9\-._]/.test(name.value)) {
|
||||||
|
bol = false;
|
||||||
|
formData.name = {
|
||||||
|
value: name.value,
|
||||||
|
isInvalid: true,
|
||||||
|
errorMsg: t('name.msg.character'),
|
||||||
|
};
|
||||||
} else if ([...name.value].length > 30) {
|
} else if ([...name.value].length > 30) {
|
||||||
bol = false;
|
bol = false;
|
||||||
formData.name = {
|
formData.name = {
|
||||||
|
|
Loading…
Reference in New Issue