connect reset password to login view (#4489)

This commit is contained in:
Jeremy Letto 2021-12-07 21:57:12 -06:00 committed by GitHub
parent 811ee54c76
commit 1f15445c69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 893 additions and 445 deletions

View file

@ -10,9 +10,29 @@ import { InputField } from 'components';
import './KnownHostForm.css';
function KnownHostForm({ host, onRemove, onSubmit }) {
const KnownHostForm = ({ host, onRemove, onSubmit }) => {
const [confirmDelete, setConfirmDelete] = useState(false);
const validate = values => {
const errors: any = {};
if (!values.name) {
errors.name = 'Required'
}
if (!values.host) {
errors.host = 'Required'
}
if (!values.port) {
errors.port = 'Required'
}
if (Object.keys(errors).length) {
return errors;
}
};
return (
<Form
initialValues={{
@ -22,25 +42,7 @@ function KnownHostForm({ host, onRemove, onSubmit }) {
port: host?.port,
}}
onSubmit={onSubmit}
validate={values => {
const errors: any = {};
if (!values.name) {
errors.name = 'Required'
}
if (!values.host) {
errors.host = 'Required'
}
if (!values.port) {
errors.port = 'Required'
}
if (Object.keys(errors).length) {
return errors;
}
}}
validate={validate}
>
{({ handleSubmit }) => (
<form className="KnownHostForm" onSubmit={handleSubmit}>
@ -74,7 +76,7 @@ function KnownHostForm({ host, onRemove, onSubmit }) {
) }
</Form>
);
}
};
const mapStateToProps = () => ({