mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
Remove old application's InvitationCodes
This commit is contained in:
@ -76,7 +76,6 @@ type Application struct {
|
||||
OrganizationObj *Organization `xorm:"-" json:"organizationObj"`
|
||||
CertPublicKey string `xorm:"-" json:"certPublicKey"`
|
||||
Tags []string `xorm:"mediumtext" json:"tags"`
|
||||
InvitationCodes []string `xorm:"varchar(200)" json:"invitationCodes"`
|
||||
SamlAttributes []*SamlItem `xorm:"varchar(1000)" json:"samlAttributes"`
|
||||
|
||||
ClientId string `xorm:"varchar(100)" json:"clientId"`
|
||||
@ -392,10 +391,6 @@ func GetMaskedApplication(application *Application, userId string) *Application
|
||||
}
|
||||
}
|
||||
|
||||
if application.InvitationCodes != nil {
|
||||
application.InvitationCodes = []string{"***"}
|
||||
}
|
||||
|
||||
return application
|
||||
}
|
||||
|
||||
|
@ -128,18 +128,6 @@ func CheckUserSignup(application *Application, organization *Organization, authF
|
||||
}
|
||||
}
|
||||
|
||||
if len(application.InvitationCodes) > 0 {
|
||||
if authForm.InvitationCode == "" {
|
||||
if application.IsSignupItemRequired("Invitation code") {
|
||||
return i18n.Translate(lang, "check:Invitation code cannot be blank")
|
||||
}
|
||||
} else {
|
||||
if !util.InSlice(application.InvitationCodes, authForm.InvitationCode) {
|
||||
return i18n.Translate(lang, "check:Invitation code is invalid")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, signupItem := range application.SignupItems {
|
||||
if signupItem.Regex == "" {
|
||||
continue
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
import React from "react";
|
||||
import {Button, Card, Col, ConfigProvider, Input, InputNumber, List, Popover, Radio, Result, Row, Select, Space, Switch, Upload} from "antd";
|
||||
import {Button, Card, Col, ConfigProvider, Input, InputNumber, Popover, Radio, Result, Row, Select, Switch, Upload} from "antd";
|
||||
import {CopyOutlined, LinkOutlined, UploadOutlined} from "@ant-design/icons";
|
||||
import * as ApplicationBackend from "./backend/ApplicationBackend";
|
||||
import * as CertBackend from "./backend/CertBackend";
|
||||
@ -141,10 +141,6 @@ class ApplicationEditPage extends React.Component {
|
||||
application.tags = [];
|
||||
}
|
||||
|
||||
if (application.invitationCodes === null) {
|
||||
application.invitationCodes = [];
|
||||
}
|
||||
|
||||
this.setState({
|
||||
application: application,
|
||||
});
|
||||
@ -873,52 +869,6 @@ class ApplicationEditPage extends React.Component {
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style={{marginTop: "20px"}} >
|
||||
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||
{Setting.getLabel(i18next.t("application:Invitation code"), i18next.t("application:Invitation code - Tooltip"))} :
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<List
|
||||
header={
|
||||
<Button type="primary" onClick={() => {
|
||||
this.updateApplicationField("invitationCodes", Setting.addRow(this.state.application.invitationCodes, Setting.getRandomName()));
|
||||
}
|
||||
}>
|
||||
{i18next.t("general:Add")}
|
||||
</Button>
|
||||
}
|
||||
dataSource={this.state.application.invitationCodes.map(code => {
|
||||
return {code: code};
|
||||
})}
|
||||
renderItem={(item, index) => (
|
||||
<List.Item key={index}>
|
||||
<Space>
|
||||
<Input value={item.code} onChange={e => {
|
||||
const invitationCodes = [...this.state.application.invitationCodes];
|
||||
invitationCodes[index] = e.target.value;
|
||||
this.updateApplicationField("invitationCodes", invitationCodes);
|
||||
}} />
|
||||
</Space>
|
||||
<Space>
|
||||
<Button icon={<CopyOutlined />} onClick={() => {
|
||||
copy(item.code);
|
||||
Setting.showMessage("success", i18next.t("general:Copied to clipboard successfully"));
|
||||
}
|
||||
}>
|
||||
{i18next.t("general:Copy")}
|
||||
</Button>
|
||||
<Button type="primary" danger onClick={() => {
|
||||
this.updateApplicationField("invitationCodes", this.state.application.invitationCodes.filter(code => code !== item.code));
|
||||
}
|
||||
}>
|
||||
{i18next.t("general:Delete")}
|
||||
</Button>
|
||||
</Space>
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user