From 089ff6c6eb765e5ea5c9d5b5fd11613722bbf5ba Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Mon, 24 May 2021 21:27:00 +0800 Subject: [PATCH] Add AffiliationUrl. --- object/application.go | 13 +++++++------ web/src/ApplicationEditPage.js | 10 ++++++++++ web/src/UserEditPage.js | 14 +++++++++++--- web/src/locales/en.json | 1 + web/src/locales/zh.json | 1 + 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/object/application.go b/object/application.go index 44cb9a1f..dc947a4c 100644 --- a/object/application.go +++ b/object/application.go @@ -35,12 +35,13 @@ type Application struct { ProviderObjs []*Provider `xorm:"-" json:"providerObjs"` OrganizationObj *Organization `xorm:"-" json:"organizationObj"` - ClientId string `xorm:"varchar(100)" json:"clientId"` - ClientSecret string `xorm:"varchar(100)" json:"clientSecret"` - RedirectUris []string `xorm:"varchar(1000)" json:"redirectUris"` - ExpireInHours int `json:"expireInHours"` - SignupUrl string `xorm:"varchar(100)" json:"signupUrl"` - ForgetUrl string `xorm:"varchar(100)" json:"forgetUrl"` + ClientId string `xorm:"varchar(100)" json:"clientId"` + ClientSecret string `xorm:"varchar(100)" json:"clientSecret"` + RedirectUris []string `xorm:"varchar(1000)" json:"redirectUris"` + ExpireInHours int `json:"expireInHours"` + SignupUrl string `xorm:"varchar(100)" json:"signupUrl"` + ForgetUrl string `xorm:"varchar(100)" json:"forgetUrl"` + AffiliationUrl string `xorm:"varchar(100)" json:"affiliationUrl"` } func GetApplications(owner string) []*Application { diff --git a/web/src/ApplicationEditPage.js b/web/src/ApplicationEditPage.js index 87ab7bd0..f685fe70 100644 --- a/web/src/ApplicationEditPage.js +++ b/web/src/ApplicationEditPage.js @@ -256,6 +256,16 @@ class ApplicationEditPage extends React.Component { }} /> + + + {i18next.t("general:Affiliation URL")}: + + + } value={this.state.application.affiliationUrl} onChange={e => { + this.updateApplicationField('affiliationUrl', e.target.value); + }} /> + + {i18next.t("general:Providers")}: diff --git a/web/src/UserEditPage.js b/web/src/UserEditPage.js index f8984308..0647ea67 100644 --- a/web/src/UserEditPage.js +++ b/web/src/UserEditPage.js @@ -286,9 +286,17 @@ class UserEditPage extends React.Component { {i18next.t("user:Affiliation")}: - { - this.updateUserField('affiliation', e.target.value); - }} /> + { + this.state.application?.affiliationUrl === "" ? ( + { + this.updateUserField('affiliation', e.target.value); + }} /> + ) : ( + + ) + } diff --git a/web/src/locales/en.json b/web/src/locales/en.json index fbf290f8..7ec47f3c 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -114,6 +114,7 @@ "Set password...": "Set password...", "Modify password...": "Modify password...", "Affiliation": "Affiliation", + "Modify affiliation": "Modify affiliation", "Tag": "Tag", "Third-party logins": "Third-party logins", "Link": "Link", diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index 72571e48..8536f2b0 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -114,6 +114,7 @@ "Set password...": "设置密码...", "Modify password...": "修改密码...", "Affiliation": "工作单位", + "Modify affiliation": "修改工作单位", "Tag": "标签", "Third-party logins": "第三方登录", "Link": "绑定",