Merge remote-tracking branch 'origin/add-custom-signup-field' into add-custom-signup-field

This commit is contained in:
okatu-loli
2024-09-24 16:09:28 +08:00
2 changed files with 38 additions and 4 deletions

View File

@ -87,7 +87,7 @@ type Application struct {
SamlReplyUrl string `xorm:"varchar(100)" json:"samlReplyUrl"` SamlReplyUrl string `xorm:"varchar(100)" json:"samlReplyUrl"`
Providers []*ProviderItem `xorm:"mediumtext" json:"providers"` Providers []*ProviderItem `xorm:"mediumtext" json:"providers"`
SigninMethods []*SigninMethod `xorm:"varchar(2000)" json:"signinMethods"` SigninMethods []*SigninMethod `xorm:"varchar(2000)" json:"signinMethods"`
SignupItems []*SignupItem `xorm:"varchar(2000)" json:"signupItems"` SignupItems []*SignupItem `xorm:"varchar(3000)" json:"signupItems"`
SigninItems []*SigninItem `xorm:"mediumtext" json:"signinItems"` SigninItems []*SigninItem `xorm:"mediumtext" json:"signinItems"`
GrantTypes []string `xorm:"varchar(1000)" json:"grantTypes"` GrantTypes []string `xorm:"varchar(1000)" json:"grantTypes"`
OrganizationObj *Organization `xorm:"-" json:"organizationObj"` OrganizationObj *Organization `xorm:"-" json:"organizationObj"`

View File

@ -634,9 +634,43 @@ class SignupPage extends React.Component {
} else if (signupItem.name === "Agreement") { } else if (signupItem.name === "Agreement") {
return AgreementModal.renderAgreementFormItem(application, required, tailFormItemLayout, this); return AgreementModal.renderAgreementFormItem(application, required, tailFormItemLayout, this);
} else if (signupItem.name.startsWith("Text ")) { } else if (signupItem.name.startsWith("Text ")) {
return ( if (signupItem.type) {
<div dangerouslySetInnerHTML={{__html: signupItem.label}} /> if (!signupItem.type || signupItem.type === "Input") {
); return (
<Form.Item
name={signupItem.name.toLowerCase().replace(" ", "_")}
label={signupItem.label ? signupItem.label : signupItem.name}
rules={[
{
required: signupItem.required,
message: i18next.t(`signup:Please input your ${signupItem.label}!`),
},
]}
>
<Input placeholder={signupItem.placeholder} />
</Form.Item>
);
} else if (signupItem.type === "Single Choice" || signupItem.type === "Multiple Choices") {
return (
<Form.Item
name={signupItem.name.toLowerCase().replace(" ", "_")}
label={signupItem.label ? signupItem.label : signupItem.name}
rules={[
{
required: signupItem.required,
message: i18next.t(`Please select your ${signupItem.label}!`),
},
]}
>
<Select
mode={signupItem.type === "Multiple Choices" ? "multiple" : "single"}
placeholder={signupItem.placeholder}
options={signupItem.options.map(option => ({label: option, value: option}))}
/>
</Form.Item>
);
}
}
} else if (signupItem.name === "Signup button") { } else if (signupItem.name === "Signup button") {
return ( return (
<Form.Item {...tailFormItemLayout}> <Form.Item {...tailFormItemLayout}>