From f3d4b45a0faee4acb6196a12e17edf7870676c64 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Sun, 15 Oct 2023 17:24:38 +0800 Subject: [PATCH] Add label and placeholder to app's signup table --- object/application.go | 14 ++++++----- web/src/auth/SignupPage.js | 49 ++++++++++++++++++------------------ web/src/table/SignupTable.js | 28 ++++++++++++++++++++- 3 files changed, 60 insertions(+), 31 deletions(-) diff --git a/object/application.go b/object/application.go index f27c4af9..8a349722 100644 --- a/object/application.go +++ b/object/application.go @@ -25,11 +25,13 @@ import ( ) type SignupItem struct { - Name string `json:"name"` - Visible bool `json:"visible"` - Required bool `json:"required"` - Prompted bool `json:"prompted"` - Rule string `json:"rule"` + Name string `json:"name"` + Visible bool `json:"visible"` + Required bool `json:"required"` + Prompted bool `json:"prompted"` + Label string `json:"label"` + Placeholder string `json:"placeholder"` + Rule string `json:"rule"` } type Application struct { @@ -54,7 +56,7 @@ type Application struct { OrgChoiceMode string `json:"orgChoiceMode"` SamlReplyUrl string `xorm:"varchar(100)" json:"samlReplyUrl"` 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"` OrganizationObj *Organization `xorm:"-" json:"organizationObj"` CertPublicKey string `xorm:"-" json:"certPublicKey"` diff --git a/web/src/auth/SignupPage.js b/web/src/auth/SignupPage.js index b3bc3353..72a9d9e3 100644 --- a/web/src/auth/SignupPage.js +++ b/web/src/auth/SignupPage.js @@ -226,7 +226,7 @@ class SignupPage extends React.Component { return ( - + ); } else if (signupItem.name === "Display name") { @@ -244,7 +244,7 @@ class SignupPage extends React.Component { - + - + ); @@ -275,7 +275,7 @@ class SignupPage extends React.Component { return ( - + ); } else if (signupItem.name === "Affiliation") { return ( - + ); } else if (signupItem.name === "ID card") { return ( - + ); } else if (signupItem.name === "Country/Region") { return ( - this.setState({email: e.target.value})} /> + this.setState({email: e.target.value})} /> { signupItem.rule !== "No verification" && - + this.setState({phone: e.target.value})} /> @@ -442,7 +443,7 @@ class SignupPage extends React.Component { signupItem.rule !== "No verification" && - + ); } else if (signupItem.name === "Confirm password") { return ( - + ); } else if (signupItem.name === "Invitation code") { return ( - + ); } else if (signupItem.name === "Agreement") { diff --git a/web/src/table/SignupTable.js b/web/src/table/SignupTable.js index 5df9b5f5..6146be25 100644 --- a/web/src/table/SignupTable.js +++ b/web/src/table/SignupTable.js @@ -14,7 +14,7 @@ import React from "react"; 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 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 ( + { + this.updateField(table, index, "label", e.target.value); + }} /> + ); + }, + }, + { + title: i18next.t("provider:Placeholder"), + dataIndex: "placeholder", + key: "placeholder", + width: "150px", + render: (text, record, index) => { + return ( + { + this.updateField(table, index, "placeholder", e.target.value); + }} /> + ); + }, + }, { title: i18next.t("application:Rule"), dataIndex: "rule",