mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-22 18:25:47 +08:00
Add label and placeholder to app's signup table
This commit is contained in:
parent
2ee4aebd96
commit
f3d4b45a0f
@ -25,11 +25,13 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SignupItem struct {
|
type SignupItem struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Visible bool `json:"visible"`
|
Visible bool `json:"visible"`
|
||||||
Required bool `json:"required"`
|
Required bool `json:"required"`
|
||||||
Prompted bool `json:"prompted"`
|
Prompted bool `json:"prompted"`
|
||||||
Rule string `json:"rule"`
|
Label string `json:"label"`
|
||||||
|
Placeholder string `json:"placeholder"`
|
||||||
|
Rule string `json:"rule"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Application struct {
|
type Application struct {
|
||||||
@ -54,7 +56,7 @@ type Application struct {
|
|||||||
OrgChoiceMode string `json:"orgChoiceMode"`
|
OrgChoiceMode string `json:"orgChoiceMode"`
|
||||||
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"`
|
||||||
SignupItems []*SignupItem `xorm:"varchar(1000)" json:"signupItems"`
|
SignupItems []*SignupItem `xorm:"varchar(2000)" json:"signupItems"`
|
||||||
GrantTypes []string `xorm:"varchar(1000)" json:"grantTypes"`
|
GrantTypes []string `xorm:"varchar(1000)" json:"grantTypes"`
|
||||||
OrganizationObj *Organization `xorm:"-" json:"organizationObj"`
|
OrganizationObj *Organization `xorm:"-" json:"organizationObj"`
|
||||||
CertPublicKey string `xorm:"-" json:"certPublicKey"`
|
CertPublicKey string `xorm:"-" json:"certPublicKey"`
|
||||||
|
@ -226,7 +226,7 @@ class SignupPage extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="username"
|
name="username"
|
||||||
label={i18next.t("signup:Username")}
|
label={signupItem.label ? signupItem.label : i18next.t("signup:Username")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: required,
|
required: required,
|
||||||
@ -235,7 +235,7 @@ class SignupPage extends React.Component {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Input />
|
<Input placeholder={signupItem.placeholder} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
} else if (signupItem.name === "Display name") {
|
} else if (signupItem.name === "Display name") {
|
||||||
@ -244,7 +244,7 @@ class SignupPage extends React.Component {
|
|||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="firstName"
|
name="firstName"
|
||||||
label={i18next.t("general:First name")}
|
label={signupItem.label ? signupItem.label : i18next.t("general:First name")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: required,
|
required: required,
|
||||||
@ -253,11 +253,11 @@ class SignupPage extends React.Component {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Input />
|
<Input placeholder={signupItem.placeholder} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="lastName"
|
name="lastName"
|
||||||
label={i18next.t("general:Last name")}
|
label={signupItem.label ? signupItem.label : i18next.t("general:Last name")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: required,
|
required: required,
|
||||||
@ -266,7 +266,7 @@ class SignupPage extends React.Component {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Input />
|
<Input placeholder={signupItem.placeholder} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
@ -275,7 +275,7 @@ class SignupPage extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="name"
|
name="name"
|
||||||
label={(signupItem.rule === "Real name" || signupItem.rule === "First, last") ? i18next.t("general:Real name") : i18next.t("general:Display name")}
|
label={(signupItem.label ? signupItem.label : (signupItem.rule === "Real name" || signupItem.rule === "First, last") ? i18next.t("general:Real name") : i18next.t("general:Display name"))}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: required,
|
required: required,
|
||||||
@ -284,14 +284,14 @@ class SignupPage extends React.Component {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Input />
|
<Input placeholder={signupItem.placeholder} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
} else if (signupItem.name === "Affiliation") {
|
} else if (signupItem.name === "Affiliation") {
|
||||||
return (
|
return (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="affiliation"
|
name="affiliation"
|
||||||
label={i18next.t("user:Affiliation")}
|
label={signupItem.label ? signupItem.label : i18next.t("user:Affiliation")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: required,
|
required: required,
|
||||||
@ -300,14 +300,14 @@ class SignupPage extends React.Component {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Input />
|
<Input placeholder={signupItem.placeholder} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
} else if (signupItem.name === "ID card") {
|
} else if (signupItem.name === "ID card") {
|
||||||
return (
|
return (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="idCard"
|
name="idCard"
|
||||||
label={i18next.t("user:ID card")}
|
label={signupItem.label ? signupItem.label : i18next.t("user:ID card")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: required,
|
required: required,
|
||||||
@ -321,14 +321,14 @@ class SignupPage extends React.Component {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Input />
|
<Input placeholder={signupItem.placeholder} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
} else if (signupItem.name === "Country/Region") {
|
} else if (signupItem.name === "Country/Region") {
|
||||||
return (
|
return (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="country_region"
|
name="country_region"
|
||||||
label={i18next.t("user:Country/Region")}
|
label={signupItem.label ? signupItem.label : i18next.t("user:Country/Region")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: required,
|
required: required,
|
||||||
@ -344,7 +344,7 @@ class SignupPage extends React.Component {
|
|||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="email"
|
name="email"
|
||||||
label={i18next.t("general:Email")}
|
label={signupItem.label ? signupItem.label : i18next.t("general:Email")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: required,
|
required: required,
|
||||||
@ -363,13 +363,13 @@ class SignupPage extends React.Component {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Input onChange={e => this.setState({email: e.target.value})} />
|
<Input placeholder={signupItem.placeholder} onChange={e => this.setState({email: e.target.value})} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{
|
{
|
||||||
signupItem.rule !== "No verification" &&
|
signupItem.rule !== "No verification" &&
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="emailCode"
|
name="emailCode"
|
||||||
label={i18next.t("code:Email code")}
|
label={signupItem.label ? signupItem.label : i18next.t("code:Email code")}
|
||||||
rules={[{
|
rules={[{
|
||||||
required: required,
|
required: required,
|
||||||
message: i18next.t("code:Please input your verification code!"),
|
message: i18next.t("code:Please input your verification code!"),
|
||||||
@ -388,7 +388,7 @@ class SignupPage extends React.Component {
|
|||||||
} else if (signupItem.name === "Phone") {
|
} else if (signupItem.name === "Phone") {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Form.Item label={i18next.t("general:Phone")} required={required}>
|
<Form.Item label={signupItem.label ? signupItem.label : i18next.t("general:Phone")} required={required}>
|
||||||
<Input.Group compact>
|
<Input.Group compact>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="countryCode"
|
name="countryCode"
|
||||||
@ -432,6 +432,7 @@ class SignupPage extends React.Component {
|
|||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
|
placeholder={signupItem.placeholder}
|
||||||
style={{width: "65%"}}
|
style={{width: "65%"}}
|
||||||
onChange={e => this.setState({phone: e.target.value})}
|
onChange={e => this.setState({phone: e.target.value})}
|
||||||
/>
|
/>
|
||||||
@ -442,7 +443,7 @@ class SignupPage extends React.Component {
|
|||||||
signupItem.rule !== "No verification" &&
|
signupItem.rule !== "No verification" &&
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="phoneCode"
|
name="phoneCode"
|
||||||
label={i18next.t("code:Phone code")}
|
label={signupItem.label ? signupItem.label : i18next.t("code:Phone code")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: required,
|
required: required,
|
||||||
@ -465,7 +466,7 @@ class SignupPage extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="password"
|
name="password"
|
||||||
label={i18next.t("general:Password")}
|
label={signupItem.label ? signupItem.label : i18next.t("general:Password")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: required,
|
required: required,
|
||||||
@ -482,14 +483,14 @@ class SignupPage extends React.Component {
|
|||||||
]}
|
]}
|
||||||
hasFeedback
|
hasFeedback
|
||||||
>
|
>
|
||||||
<Input.Password />
|
<Input.Password placeholder={signupItem.placeholder} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
} else if (signupItem.name === "Confirm password") {
|
} else if (signupItem.name === "Confirm password") {
|
||||||
return (
|
return (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="confirm"
|
name="confirm"
|
||||||
label={i18next.t("signup:Confirm")}
|
label={signupItem.label ? signupItem.label : i18next.t("signup:Confirm")}
|
||||||
dependencies={["password"]}
|
dependencies={["password"]}
|
||||||
hasFeedback
|
hasFeedback
|
||||||
rules={[
|
rules={[
|
||||||
@ -508,14 +509,14 @@ class SignupPage extends React.Component {
|
|||||||
}),
|
}),
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Input.Password />
|
<Input.Password placeholder={signupItem.placeholder} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
} else if (signupItem.name === "Invitation code") {
|
} else if (signupItem.name === "Invitation code") {
|
||||||
return (
|
return (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="invitationCode"
|
name="invitationCode"
|
||||||
label={i18next.t("application:Invitation code")}
|
label={signupItem.label ? signupItem.label : i18next.t("application:Invitation code")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: required,
|
required: required,
|
||||||
@ -523,7 +524,7 @@ class SignupPage extends React.Component {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Input />
|
<Input placeholder={signupItem.placeholder} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
} else if (signupItem.name === "Agreement") {
|
} else if (signupItem.name === "Agreement") {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {DeleteOutlined, DownOutlined, UpOutlined} from "@ant-design/icons";
|
import {DeleteOutlined, DownOutlined, UpOutlined} from "@ant-design/icons";
|
||||||
import {Button, Col, Row, Select, Switch, Table, Tooltip} from "antd";
|
import {Button, Col, Input, Row, Select, Switch, Table, Tooltip} from "antd";
|
||||||
import * as Setting from "../Setting";
|
import * as Setting from "../Setting";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
|
||||||
@ -164,6 +164,32 @@ class SignupTable extends React.Component {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: i18next.t("provider:Label"),
|
||||||
|
dataIndex: "label",
|
||||||
|
key: "label",
|
||||||
|
width: "150px",
|
||||||
|
render: (text, record, index) => {
|
||||||
|
return (
|
||||||
|
<Input value={text} onChange={e => {
|
||||||
|
this.updateField(table, index, "label", e.target.value);
|
||||||
|
}} />
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: i18next.t("provider:Placeholder"),
|
||||||
|
dataIndex: "placeholder",
|
||||||
|
key: "placeholder",
|
||||||
|
width: "150px",
|
||||||
|
render: (text, record, index) => {
|
||||||
|
return (
|
||||||
|
<Input value={text} onChange={e => {
|
||||||
|
this.updateField(table, index, "placeholder", e.target.value);
|
||||||
|
}} />
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: i18next.t("application:Rule"),
|
title: i18next.t("application:Rule"),
|
||||||
dataIndex: "rule",
|
dataIndex: "rule",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user