mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-24 08:20:31 +08:00
Add SignupUrl and ForgetUrl to Application.
This commit is contained in:
parent
76e4490aa7
commit
813204194f
@ -39,6 +39,8 @@ type Application struct {
|
||||
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"`
|
||||
}
|
||||
|
||||
func GetApplications(owner string) []*Application {
|
||||
|
@ -236,6 +236,26 @@ class ApplicationEditPage extends React.Component {
|
||||
}} />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style={{marginTop: '20px'}} >
|
||||
<Col style={{marginTop: '5px'}} span={2}>
|
||||
{i18next.t("general:Signup URL")}:
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Input prefix={<LinkOutlined/>} value={this.state.application.signupUrl} onChange={e => {
|
||||
this.updateApplicationField('signupUrl', e.target.value);
|
||||
}} />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style={{marginTop: '20px'}} >
|
||||
<Col style={{marginTop: '5px'}} span={2}>
|
||||
{i18next.t("general:Forget URL")}:
|
||||
</Col>
|
||||
<Col span={22} >
|
||||
<Input prefix={<LinkOutlined/>} value={this.state.application.forgetUrl} onChange={e => {
|
||||
this.updateApplicationField('forgetUrl', e.target.value);
|
||||
}} />
|
||||
</Col>
|
||||
</Row>
|
||||
<Row style={{marginTop: '20px'}} >
|
||||
<Col style={{marginTop: '5px'}} span={2}>
|
||||
{i18next.t("general:Providers")}:
|
||||
|
@ -212,6 +212,38 @@ export function goToLogin(ths, application) {
|
||||
}
|
||||
}
|
||||
|
||||
export function goToSignup(ths, application) {
|
||||
if (application === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (authConfig.appName === application.name) {
|
||||
goToLinkSoft(ths, "/signup");
|
||||
} else {
|
||||
if (application.signupUrl === "") {
|
||||
goToLinkSoft(ths, `/signup/${application.name}`);
|
||||
} else {
|
||||
goToLink(application.signupUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function goToForget(ths, application) {
|
||||
if (application === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (authConfig.appName === application.name) {
|
||||
goToLinkSoft(ths, "/forget");
|
||||
} else {
|
||||
if (application.signupUrl === "") {
|
||||
goToLinkSoft(ths, `/forget/${application.name}`);
|
||||
} else {
|
||||
goToLink(application.forgetUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function renderHelmet(application) {
|
||||
if (application === undefined || application === null || application.organizationObj === undefined || application.organizationObj === null ||application.organizationObj === "") {
|
||||
return null;
|
||||
|
@ -140,14 +140,6 @@ class LoginPage extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
getSignupPath(application) {
|
||||
if (authConfig.appName === application.name) {
|
||||
return "/signup";
|
||||
} else {
|
||||
return `/signup/${application.name}`;
|
||||
}
|
||||
}
|
||||
|
||||
renderForm(application) {
|
||||
if (this.state.msg !== null) {
|
||||
return Util.renderMessage(this.state.msg)
|
||||
@ -203,7 +195,9 @@ class LoginPage extends React.Component {
|
||||
{i18next.t("login:Auto login")}
|
||||
</Checkbox>
|
||||
</Form.Item>
|
||||
<Link style={{float: "right"}} to="/forgot">
|
||||
<Link style={{float: "right"}} onClick={() => {
|
||||
Setting.goToForget(this, application);
|
||||
}}>
|
||||
{i18next.t("login:Forgot password?")}
|
||||
</Link>
|
||||
</Form.Item>
|
||||
@ -220,7 +214,9 @@ class LoginPage extends React.Component {
|
||||
!application.enableSignUp ? null : (
|
||||
<div style={{float: "right"}}>
|
||||
{i18next.t("login:No account yet?")}
|
||||
<Link to={this.getSignupPath(application)}>
|
||||
<Link onClick={() => {
|
||||
Setting.goToSignup(this, application);
|
||||
}}>
|
||||
{i18next.t("login:sign up now")}
|
||||
</Link>
|
||||
</div>
|
||||
@ -259,9 +255,11 @@ class LoginPage extends React.Component {
|
||||
<div>
|
||||
<br/>
|
||||
<div style={{float: "right"}}>
|
||||
No account yet?
|
||||
<Link to={this.getSignupPath(application)}>
|
||||
sign up now
|
||||
{i18next.t("login:No account yet?")}
|
||||
<Link onClick={() => {
|
||||
Setting.goToSignup(this, application);
|
||||
}}>
|
||||
{i18next.t("login:sign up now")}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user