parent
bd6b3dcbe3
commit
9edce7116e
@ -0,0 +1,68 @@
|
||||
import {
|
||||
digitReg,
|
||||
lowercaseReg,
|
||||
specialCharacterReg,
|
||||
uppercaseReg
|
||||
} from '@/config';
|
||||
import { CheckCircleFilled, CloseCircleFilled } from '@ant-design/icons';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { Space } from 'antd';
|
||||
|
||||
const PasswordValidate: React.FC<{ value: string }> = ({ value = '' }) => {
|
||||
const intl = useIntl();
|
||||
|
||||
const renderIcon = ({ valid, text }: { valid: boolean; text: string }) => {
|
||||
return (
|
||||
<>
|
||||
{valid ? (
|
||||
<CheckCircleFilled style={{ color: 'green' }} />
|
||||
) : (
|
||||
<CloseCircleFilled style={{ color: 'red' }} />
|
||||
)}
|
||||
<span
|
||||
className="m-l-5"
|
||||
style={{ color: 'var(--ant-color-text-description)' }}
|
||||
>
|
||||
{text}
|
||||
</span>
|
||||
</>
|
||||
);
|
||||
};
|
||||
return (
|
||||
<Space direction="vertical" style={{ paddingTop: '10px' }}>
|
||||
<span>
|
||||
{renderIcon({
|
||||
valid: uppercaseReg.test(value),
|
||||
text: intl.formatMessage({ id: 'users.password.uppcase' })
|
||||
})}
|
||||
</span>
|
||||
<span>
|
||||
{renderIcon({
|
||||
valid: lowercaseReg.test(value),
|
||||
text: intl.formatMessage({ id: 'users.password.lowercase' })
|
||||
})}
|
||||
</span>
|
||||
|
||||
<span>
|
||||
{renderIcon({
|
||||
valid: digitReg.test(value),
|
||||
text: intl.formatMessage({ id: 'users.password.number' })
|
||||
})}
|
||||
</span>
|
||||
<span>
|
||||
{renderIcon({
|
||||
valid: value.length >= 6 && value.length <= 12,
|
||||
text: intl.formatMessage({ id: 'users.password.length' })
|
||||
})}
|
||||
</span>
|
||||
<span>
|
||||
{renderIcon({
|
||||
valid: specialCharacterReg.test(value),
|
||||
text: intl.formatMessage({ id: 'users.password.special' })
|
||||
})}
|
||||
</span>
|
||||
</Space>
|
||||
);
|
||||
};
|
||||
|
||||
export default PasswordValidate;
|
||||
@ -1,6 +1,9 @@
|
||||
export default {
|
||||
'apikeys.title': 'API Keys',
|
||||
'apikeys.table.apikeys': 'keys',
|
||||
'apikeys.button.create': 'New API Key',
|
||||
'apikeys.form.expiretime': 'Expiration',
|
||||
'apikeys.table.name': 'Key Name'
|
||||
'apikeys.table.name': 'Key Name',
|
||||
'apikeys.table.save.tips':
|
||||
'Make sure to copy your key immediately. You will not be able to see it again.'
|
||||
};
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
export default {
|
||||
'users.title': 'Users',
|
||||
'users.button.create': 'Create User',
|
||||
'users.form.edit': 'Edit User',
|
||||
'users.form.create': 'Create User',
|
||||
'users.table.username': 'User Name',
|
||||
'users.table.role': 'Role',
|
||||
'users.form.fullname': 'Full Name',
|
||||
'users.table.user': 'users',
|
||||
'users.form.admin': 'Admin',
|
||||
'users.form.user': 'User',
|
||||
'users.form.newpassword': 'New Password',
|
||||
'users.form.currentpassword': 'Current Password',
|
||||
'users.form.updatepassword': 'Modify Password',
|
||||
'users.form.rule.password':
|
||||
'Contains uppercase and lowercase letters, numbers, and special characters, 6 to 12 characters in length, no spaces allowed.',
|
||||
'users.password.uppcase': 'At least one uppercase letter',
|
||||
'users.password.lowercase': 'At least one lowercase letter',
|
||||
'users.password.number': 'At least one number',
|
||||
'users.password.special': 'At least one special character',
|
||||
'users.password.length': 'Length between 6 and 12 characters'
|
||||
};
|
||||
@ -1,6 +1,8 @@
|
||||
export default {
|
||||
'apikeys.title': 'API 密钥',
|
||||
'apikeys.table.apikeys': '密钥',
|
||||
'apikeys.button.create': '新建 API 密钥',
|
||||
'apikeys.form.expiretime': '过期时间',
|
||||
'apikeys.table.name': '密钥名称'
|
||||
'apikeys.table.name': '密钥名称',
|
||||
'apikeys.table.save.tips': '确保立即复制您的密钥。您将无法再次看到它!'
|
||||
};
|
||||
|
||||
Loading…
Reference in new issue