mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-08 09:01:00 +08:00
Add app's TermsOfUse.
This commit is contained in:
@ -43,6 +43,7 @@ type Application struct {
|
|||||||
SigninUrl string `xorm:"varchar(100)" json:"signinUrl"`
|
SigninUrl string `xorm:"varchar(100)" json:"signinUrl"`
|
||||||
ForgetUrl string `xorm:"varchar(100)" json:"forgetUrl"`
|
ForgetUrl string `xorm:"varchar(100)" json:"forgetUrl"`
|
||||||
AffiliationUrl string `xorm:"varchar(100)" json:"affiliationUrl"`
|
AffiliationUrl string `xorm:"varchar(100)" json:"affiliationUrl"`
|
||||||
|
TermsOfUse string `xorm:"varchar(1000)" json:"termsOfUse"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetApplications(owner string) []*Application {
|
func GetApplications(owner string) []*Application {
|
||||||
|
@ -27,6 +27,7 @@ import ProviderTable from "./ProviderTable";
|
|||||||
import SignupTable from "./SignupTable";
|
import SignupTable from "./SignupTable";
|
||||||
import PromptPage from "./auth/PromptPage";
|
import PromptPage from "./auth/PromptPage";
|
||||||
|
|
||||||
|
const { TextArea } = Input;
|
||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
|
|
||||||
class ApplicationEditPage extends React.Component {
|
class ApplicationEditPage extends React.Component {
|
||||||
@ -280,6 +281,16 @@ class ApplicationEditPage extends React.Component {
|
|||||||
}} />
|
}} />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
<Row style={{marginTop: '20px'}} >
|
||||||
|
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
|
{Setting.getLabel(i18next.t("provider:Terms of Use"), i18next.t("provider:Terms of Use - Tooltip"))} :
|
||||||
|
</Col>
|
||||||
|
<Col span={22} >
|
||||||
|
<TextArea autoSize={{minRows: 1, maxRows: 6}} value={this.state.application.termsOfUse} onChange={e => {
|
||||||
|
this.updateApplicationField('termsOfUse', e.target.value);
|
||||||
|
}} />
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
<Row style={{marginTop: '20px'}} >
|
<Row style={{marginTop: '20px'}} >
|
||||||
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
<Col style={{marginTop: '5px'}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
{Setting.getLabel(i18next.t("general:Providers"), i18next.t("general:Providers - Tooltip"))} :
|
{Setting.getLabel(i18next.t("general:Providers"), i18next.t("general:Providers - Tooltip"))} :
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {Link} from "react-router-dom";
|
import {Link} from "react-router-dom";
|
||||||
import {Form, Input, Checkbox, Button, Row, Col, Result} from 'antd';
|
import {Form, Input, Checkbox, Button, Row, Col, Result, Modal} from 'antd';
|
||||||
import * as Setting from "../Setting";
|
import * as Setting from "../Setting";
|
||||||
import * as AuthBackend from "./AuthBackend";
|
import * as AuthBackend from "./AuthBackend";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
@ -71,6 +71,7 @@ class SignupPage extends React.Component {
|
|||||||
validEmail: false,
|
validEmail: false,
|
||||||
validPhone: false,
|
validPhone: false,
|
||||||
region: "",
|
region: "",
|
||||||
|
isTermsOfUseVisible: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.form = React.createRef();
|
this.form = React.createRef();
|
||||||
@ -388,7 +389,11 @@ class SignupPage extends React.Component {
|
|||||||
>
|
>
|
||||||
<Checkbox>
|
<Checkbox>
|
||||||
{i18next.t("signup:Accept")}
|
{i18next.t("signup:Accept")}
|
||||||
<Link to={"/agreement"}>
|
<Link onClick={() => {
|
||||||
|
this.setState({
|
||||||
|
isTermsOfUseVisible: true,
|
||||||
|
});
|
||||||
|
}}>
|
||||||
{i18next.t("signup:Terms of Use")}
|
{i18next.t("signup:Terms of Use")}
|
||||||
</Link>
|
</Link>
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
@ -397,6 +402,32 @@ class SignupPage extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderModal() {
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
title={i18next.t("signup:Terms of Use")}
|
||||||
|
visible={this.state.isTermsOfUseVisible}
|
||||||
|
closable={false}
|
||||||
|
footer={[
|
||||||
|
<Button key="agree" type="primary" onClick={() => {
|
||||||
|
this.setState({
|
||||||
|
isTermsOfUseVisible: false,
|
||||||
|
});
|
||||||
|
}}>
|
||||||
|
{i18next.t("user:OK")}
|
||||||
|
</Button>,
|
||||||
|
// <Button key="decline" onClick={() => {
|
||||||
|
// this.props.history.goBack();
|
||||||
|
// }}>
|
||||||
|
// {i18next.t("signup:Decline")}
|
||||||
|
// </Button>,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<div dangerouslySetInnerHTML={{__html: this.state.application.termsOfUse}} />
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
renderForm(application) {
|
renderForm(application) {
|
||||||
if (!application.enableSignUp) {
|
if (!application.enableSignUp) {
|
||||||
return (
|
return (
|
||||||
@ -493,6 +524,9 @@ class SignupPage extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
{
|
||||||
|
this.renderModal()
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user