mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
Fix email must input bug in signup page.
This commit is contained in:
File diff suppressed because one or more lines are too long
@ -255,13 +255,13 @@ class SignupPage extends React.Component {
|
||||
},
|
||||
{
|
||||
validator: (_, value) => {
|
||||
if( Setting.EmailRegEx.test(this.state.email) ) {
|
||||
this.setState({validEmail: true})
|
||||
return Promise.resolve()
|
||||
} else {
|
||||
this.setState({validEmail: false})
|
||||
return Promise.reject(i18next.t("signup:The input is not valid Email!"))
|
||||
if (this.state.email !== "" && !Setting.isValidEmail(this.state.email)) {
|
||||
this.setState({validEmail: false});
|
||||
return Promise.reject(i18next.t("signup:The input is not valid Email!"));
|
||||
}
|
||||
|
||||
this.setState({validEmail: true});
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
]}
|
||||
@ -287,6 +287,60 @@ class SignupPage extends React.Component {
|
||||
</Form.Item>
|
||||
</React.Fragment>
|
||||
)
|
||||
} else if (signupItem.name === "Phone") {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Form.Item
|
||||
name="phone"
|
||||
key="phone"
|
||||
label={i18next.t("general:Phone")}
|
||||
rules={[
|
||||
{
|
||||
required: required,
|
||||
message: i18next.t("signup:Please input your phone number!"),
|
||||
},
|
||||
{
|
||||
validator: (_, value) =>{
|
||||
if (this.state.phone !== "" && !Setting.isValidPhone(this.state.phone)) {
|
||||
this.setState({validPhone: false});
|
||||
return Promise.reject(i18next.t("signup:The input is not valid Phone!"));
|
||||
}
|
||||
|
||||
this.setState({validPhone: true});
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
]}
|
||||
>
|
||||
<Input
|
||||
style={{
|
||||
width: '100%',
|
||||
}}
|
||||
addonBefore={`+${this.state.application?.organizationObj.phonePrefix}`}
|
||||
onChange={e => this.setState({phone: e.target.value})}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="phoneCode"
|
||||
key="phoneCode"
|
||||
label={i18next.t("code:Phone code")}
|
||||
rules={[
|
||||
{
|
||||
required: required,
|
||||
message: i18next.t("code:Please input your phone verification code!"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<CountDownInput
|
||||
disabled={!this.state.validPhone}
|
||||
defaultButtonText={i18next.t("code:Send Code")}
|
||||
onButtonClick={UserBackend.sendCode}
|
||||
onButtonClickArgs={[this.state.phone, "phone", application.organizationObj.owner + "/" + application.organizationObj.name]}
|
||||
coolDownTime={60}
|
||||
/>
|
||||
</Form.Item>
|
||||
</React.Fragment>
|
||||
)
|
||||
} else if (signupItem.name === "Password") {
|
||||
return (
|
||||
<Form.Item
|
||||
@ -331,60 +385,6 @@ class SignupPage extends React.Component {
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
)
|
||||
} else if (signupItem.name === "Phone") {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Form.Item
|
||||
name="phone"
|
||||
key="phone"
|
||||
label={i18next.t("general:Phone")}
|
||||
rules={[
|
||||
{
|
||||
required: required,
|
||||
message: i18next.t("signup:Please input your phone number!"),
|
||||
},
|
||||
{
|
||||
validator: (_, value) =>{
|
||||
if ( Setting.PhoneRegEx.test(this.state.phone)) {
|
||||
this.setState({validPhone: true})
|
||||
return Promise.resolve()
|
||||
} else {
|
||||
this.setState({validPhone: false})
|
||||
return Promise.reject(i18next.t("signup:The input is not valid Phone!"))
|
||||
}
|
||||
}
|
||||
}
|
||||
]}
|
||||
>
|
||||
<Input
|
||||
style={{
|
||||
width: '100%',
|
||||
}}
|
||||
addonBefore={`+${this.state.application?.organizationObj.phonePrefix}`}
|
||||
onChange={e => this.setState({phone: e.target.value})}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="phoneCode"
|
||||
key="phoneCode"
|
||||
label={i18next.t("code:Phone code")}
|
||||
rules={[
|
||||
{
|
||||
required: required,
|
||||
message: i18next.t("code:Please input your phone verification code!"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<CountDownInput
|
||||
disabled={!this.state.validPhone}
|
||||
defaultButtonText={i18next.t("code:Send Code")}
|
||||
onButtonClick={UserBackend.sendCode}
|
||||
onButtonClickArgs={[this.state.phone, "phone", application.organizationObj.owner + "/" + application.organizationObj.name]}
|
||||
coolDownTime={60}
|
||||
/>
|
||||
</Form.Item>
|
||||
</React.Fragment>
|
||||
)
|
||||
} else if (signupItem.name === "Agreement") {
|
||||
return (
|
||||
<Form.Item
|
||||
|
Reference in New Issue
Block a user