|
|
@ -38,12 +38,10 @@ const Register: React.FC = () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else if (status === 200) {
|
|
|
|
} else if (status === 200) {
|
|
|
|
setTimeout(() => {
|
|
|
|
message.error({
|
|
|
|
message.error({
|
|
|
|
content: "This username already exists!",
|
|
|
|
content: "This username already exists!",
|
|
|
|
duration: 2,
|
|
|
|
duration: 2,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -72,55 +70,55 @@ const Register: React.FC = () => {
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<h1>Sign up</h1>
|
|
|
|
<h1>Sign up</h1>
|
|
|
|
{/* { && ( */}
|
|
|
|
{/* { && ( */}
|
|
|
|
<Card
|
|
|
|
<Card
|
|
|
|
bodyStyle={{ background: "rgb(250, 250, 250)" }}
|
|
|
|
bodyStyle={{ background: "rgb(250, 250, 250)" }}
|
|
|
|
title={emailDom}
|
|
|
|
title={emailDom}
|
|
|
|
className="login-form-card "
|
|
|
|
className="login-form-card "
|
|
|
|
style={{ width: 600, textAlign: "left" }}
|
|
|
|
style={{ width: 600, textAlign: "left" }}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<Space
|
|
|
|
|
|
|
|
direction="vertical"
|
|
|
|
|
|
|
|
size="middle"
|
|
|
|
|
|
|
|
style={{ display: "flex", gap: "20px", margin: "auto" }}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<Space
|
|
|
|
<Row gutter={24}>
|
|
|
|
direction="vertical"
|
|
|
|
<Col span={12}>
|
|
|
|
size="middle"
|
|
|
|
<Form.Item
|
|
|
|
style={{ display: "flex", gap: "20px", margin: "auto" }}
|
|
|
|
name="first_name"
|
|
|
|
>
|
|
|
|
rules={[
|
|
|
|
<Row gutter={24}>
|
|
|
|
{
|
|
|
|
<Col span={12}>
|
|
|
|
required: true,
|
|
|
|
<Form.Item
|
|
|
|
message: "Please input your first name!",
|
|
|
|
name="first_name"
|
|
|
|
whitespace: true,
|
|
|
|
rules={[
|
|
|
|
},
|
|
|
|
{
|
|
|
|
]}
|
|
|
|
required: true,
|
|
|
|
>
|
|
|
|
message: "Please input your first name!",
|
|
|
|
<Input
|
|
|
|
whitespace: true,
|
|
|
|
// prefix={<UserOutlined className="site-form-item-icon" />}
|
|
|
|
},
|
|
|
|
placeholder="First name"
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
>
|
|
|
|
</Form.Item>
|
|
|
|
<Input
|
|
|
|
</Col>
|
|
|
|
// prefix={<UserOutlined className="site-form-item-icon" />}
|
|
|
|
<Col span={12}>
|
|
|
|
placeholder="First name"
|
|
|
|
<Form.Item
|
|
|
|
/>
|
|
|
|
name="last_name"
|
|
|
|
</Form.Item>
|
|
|
|
rules={[
|
|
|
|
</Col>
|
|
|
|
{
|
|
|
|
<Col span={12}>
|
|
|
|
required: true,
|
|
|
|
<Form.Item
|
|
|
|
message: "Please input your last name!",
|
|
|
|
name="last_name"
|
|
|
|
whitespace: true,
|
|
|
|
rules={[
|
|
|
|
},
|
|
|
|
{
|
|
|
|
]}
|
|
|
|
required: true,
|
|
|
|
>
|
|
|
|
message: "Please input your last name!",
|
|
|
|
<Input
|
|
|
|
whitespace: true,
|
|
|
|
// prefix={<UserOutlined className="site-form-item-icon" />}
|
|
|
|
},
|
|
|
|
placeholder="Last name"
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
>
|
|
|
|
</Form.Item>
|
|
|
|
<Input
|
|
|
|
</Col>
|
|
|
|
// prefix={<UserOutlined className="site-form-item-icon" />}
|
|
|
|
</Row>
|
|
|
|
placeholder="Last name"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
</Col>
|
|
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
|
name="email"
|
|
|
|
name="email"
|
|
|
|
rules={[
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -149,119 +147,119 @@ const Register: React.FC = () => {
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
</Form.Item>
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
|
name="username"
|
|
|
|
name="username"
|
|
|
|
tooltip="What do you want others to call you?"
|
|
|
|
tooltip="What do you want others to call you?"
|
|
|
|
rules={[
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
required: true,
|
|
|
|
message: "Please input your username!",
|
|
|
|
message: "Please input your username!",
|
|
|
|
whitespace: true,
|
|
|
|
whitespace: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
]}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<Input
|
|
|
|
<Input
|
|
|
|
prefix={<UserOutlined className="site-form-item-icon" />}
|
|
|
|
prefix={<UserOutlined className="site-form-item-icon" />}
|
|
|
|
placeholder="Username"
|
|
|
|
placeholder="Username"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</Form.Item>
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
|
name="password"
|
|
|
|
name="password"
|
|
|
|
rules={[
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
required: true,
|
|
|
|
message: "Please input your password!",
|
|
|
|
message: "Please input your password!",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
min: 8,
|
|
|
|
|
|
|
|
message:
|
|
|
|
|
|
|
|
"Your password must contain at least 8 characters.",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
() => ({
|
|
|
|
|
|
|
|
validator(_, value) {
|
|
|
|
|
|
|
|
if (!value || /[^0-9]+/.test(value)) {
|
|
|
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return Promise.reject(
|
|
|
|
|
|
|
|
new Error("Your password can’t be entirely numeric.")
|
|
|
|
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
}),
|
|
|
|
min: 8,
|
|
|
|
() => ({
|
|
|
|
message:
|
|
|
|
validator(_, value) {
|
|
|
|
"Your password must contain at least 8 characters.",
|
|
|
|
// Список общеупотребимых паролей (пример)
|
|
|
|
|
|
|
|
const commonPasswords = common;
|
|
|
|
|
|
|
|
if (!value || !commonPasswords.includes(value)) {
|
|
|
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return Promise.reject(
|
|
|
|
|
|
|
|
new Error(
|
|
|
|
|
|
|
|
"Your password can’t be a commonly used password."
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
() => ({
|
|
|
|
}),
|
|
|
|
validator(_, value) {
|
|
|
|
({ getFieldValue }) => ({
|
|
|
|
if (!value || /[^0-9]+/.test(value)) {
|
|
|
|
validator(_, value) {
|
|
|
|
return Promise.resolve();
|
|
|
|
const personalInfo = getFieldValue("username");
|
|
|
|
}
|
|
|
|
if (!value || !value.includes(personalInfo)) {
|
|
|
|
return Promise.reject(
|
|
|
|
return Promise.resolve();
|
|
|
|
new Error("Your password can’t be entirely numeric.")
|
|
|
|
}
|
|
|
|
);
|
|
|
|
return Promise.reject(
|
|
|
|
},
|
|
|
|
new Error(
|
|
|
|
}),
|
|
|
|
"Your password can’t be too similar to your other personal information."
|
|
|
|
() => ({
|
|
|
|
)
|
|
|
|
validator(_, value) {
|
|
|
|
);
|
|
|
|
// Список общеупотребимых паролей (пример)
|
|
|
|
},
|
|
|
|
const commonPasswords = common;
|
|
|
|
}),
|
|
|
|
if (!value || !commonPasswords.includes(value)) {
|
|
|
|
]}
|
|
|
|
return Promise.resolve();
|
|
|
|
hasFeedback
|
|
|
|
}
|
|
|
|
>
|
|
|
|
return Promise.reject(
|
|
|
|
<Input.Password
|
|
|
|
new Error(
|
|
|
|
prefix={<LockOutlined className="site-form-item-icon" />}
|
|
|
|
"Your password can’t be a commonly used password."
|
|
|
|
type="password"
|
|
|
|
)
|
|
|
|
placeholder="Password"
|
|
|
|
);
|
|
|
|
/>
|
|
|
|
},
|
|
|
|
</Form.Item>
|
|
|
|
}),
|
|
|
|
|
|
|
|
({ getFieldValue }) => ({
|
|
|
|
|
|
|
|
validator(_, value) {
|
|
|
|
|
|
|
|
const personalInfo = getFieldValue("username");
|
|
|
|
|
|
|
|
if (!value || !value.includes(personalInfo)) {
|
|
|
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return Promise.reject(
|
|
|
|
|
|
|
|
new Error(
|
|
|
|
|
|
|
|
"Your password can’t be too similar to your other personal information."
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
]}
|
|
|
|
|
|
|
|
hasFeedback
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<Input.Password
|
|
|
|
|
|
|
|
prefix={<LockOutlined className="site-form-item-icon" />}
|
|
|
|
|
|
|
|
type="password"
|
|
|
|
|
|
|
|
placeholder="Password"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item
|
|
|
|
<Form.Item
|
|
|
|
name="password_confirm"
|
|
|
|
name="password_confirm"
|
|
|
|
dependencies={["password"]}
|
|
|
|
dependencies={["password"]}
|
|
|
|
hasFeedback
|
|
|
|
hasFeedback
|
|
|
|
rules={[
|
|
|
|
rules={[
|
|
|
|
{
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
required: true,
|
|
|
|
message: "Please confirm your password!",
|
|
|
|
message: "Please confirm your password!",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
({ getFieldValue }) => ({
|
|
|
|
|
|
|
|
validator(_, value) {
|
|
|
|
|
|
|
|
if (!value || getFieldValue("password") === value) {
|
|
|
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return Promise.reject(
|
|
|
|
|
|
|
|
new Error(
|
|
|
|
|
|
|
|
"The new password that you entered do not match!"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
({ getFieldValue }) => ({
|
|
|
|
}),
|
|
|
|
validator(_, value) {
|
|
|
|
]}
|
|
|
|
if (!value || getFieldValue("password") === value) {
|
|
|
|
>
|
|
|
|
return Promise.resolve();
|
|
|
|
<Input.Password
|
|
|
|
}
|
|
|
|
prefix={<LockOutlined className="site-form-item-icon" />}
|
|
|
|
return Promise.reject(
|
|
|
|
type="password"
|
|
|
|
new Error(
|
|
|
|
placeholder="Re-enter Password"
|
|
|
|
"The new password that you entered do not match!"
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
</Form.Item>
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
]}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<Input.Password
|
|
|
|
|
|
|
|
prefix={<LockOutlined className="site-form-item-icon" />}
|
|
|
|
|
|
|
|
type="password"
|
|
|
|
|
|
|
|
placeholder="Re-enter Password"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item>
|
|
|
|
<Form.Item>
|
|
|
|
<Button type="primary" htmlType="submit" loading={loading}>
|
|
|
|
<Button type="primary" htmlType="submit" loading={loading}>
|
|
|
|
Confirm
|
|
|
|
Confirm
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
|
</Form.Item>
|
|
|
|
</Form.Item>
|
|
|
|
</Space>
|
|
|
|
</Space>
|
|
|
|
</Card>
|
|
|
|
</Card>
|
|
|
|
{/* )} */}
|
|
|
|
{/* )} */}
|
|
|
|
</Space>
|
|
|
|
</Space>
|
|
|
|
</Form>
|
|
|
|
</Form>
|
|
|
|