Require agreement on signup.

This commit is contained in:
Will O'Beirne 2019-02-04 15:45:11 -05:00
parent 3b76219f18
commit 29f59aa81d
No known key found for this signature in database
GPG Key ID: 44C190DB5DEAF9F6
2 changed files with 47 additions and 1 deletions

View File

@ -19,5 +19,24 @@
&-alert {
margin-top: 1rem;
}
&-legal {
display: block;
margin-bottom: 1rem;
&-text {
font-size: 0.75rem;
line-height: 1.2rem;
opacity: 0.8;
}
.ant-form-item-control {
line-height: inherit;
}
}
.PasswordFormItems .ant-row {
margin-bottom: 0.75rem;
}
}
}

View File

@ -1,11 +1,12 @@
import React from 'react';
import { connect } from 'react-redux';
import { Form, Input, Button, Alert } from 'antd';
import { Form, Input, Button, Checkbox, Alert } from 'antd';
import { FormComponentProps } from 'antd/lib/form';
import { authActions } from 'modules/auth';
import { AppState } from 'store/reducers';
import PasswordFormItems from 'components/PasswordFormItems';
import './SignUp.less';
import { Link } from 'react-router-dom';
interface StateProps {
isCreatingUser: AppState['auth']['isCreatingUser'];
@ -67,6 +68,32 @@ class SignUp extends React.Component<Props> {
<PasswordFormItems form={this.props.form} />
<Form.Item className="SignUp-form-legal">
{getFieldDecorator('hasAgreed', {
rules: [
{ required: true, message: 'You must agree to create an account' },
],
})(
<Checkbox name="hasAgreed">
<span className="SignUp-form-legal-text">
I agree to the{' '}
<Link target="_blank" to="/code-of-conduct">
code of conduct
</Link>
,{' '}
<Link target="_blank" to="/tos">
terms of service
</Link>
, and{' '}
<Link target="_blank" to="/privacy">
privacy policy
</Link>
.
</span>
</Checkbox>,
)}
</Form.Item>
<div className="SignUp-form-controls">
<Button
type="primary"