2021-04-12 13:32:25 +00:00
|
|
|
import React, { Component } from "react";
|
|
|
|
import PropTypes from "prop-types";
|
2016-12-29 20:27:43 +00:00
|
|
|
|
2021-04-12 13:32:25 +00:00
|
|
|
import Form from "components/forms/Form";
|
|
|
|
import formFieldInterface from "interfaces/form_field";
|
|
|
|
import Button from "components/buttons/Button";
|
|
|
|
import InputFieldWithIcon from "components/forms/fields/InputFieldWithIcon";
|
|
|
|
import helpers from "./helpers";
|
2016-12-29 20:27:43 +00:00
|
|
|
|
2021-04-12 13:32:25 +00:00
|
|
|
const formFields = ["name", "username", "password", "password_confirmation"];
|
2016-12-29 20:27:43 +00:00
|
|
|
const { validate } = helpers;
|
|
|
|
|
|
|
|
class ConfirmInviteForm extends Component {
|
|
|
|
static propTypes = {
|
2017-01-06 00:01:17 +00:00
|
|
|
baseError: PropTypes.string,
|
2016-12-29 20:27:43 +00:00
|
|
|
className: PropTypes.string,
|
|
|
|
fields: PropTypes.shape({
|
|
|
|
name: formFieldInterface.isRequired,
|
|
|
|
username: formFieldInterface.isRequired,
|
|
|
|
password: formFieldInterface.isRequired,
|
|
|
|
password_confirmation: formFieldInterface.isRequired,
|
|
|
|
}).isRequired,
|
|
|
|
handleSubmit: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
2021-04-12 13:32:25 +00:00
|
|
|
render() {
|
2017-01-06 00:01:17 +00:00
|
|
|
const { baseError, className, fields, handleSubmit } = this.props;
|
2016-12-29 20:27:43 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<form className={className}>
|
2017-01-06 00:01:17 +00:00
|
|
|
{baseError && <div className="form__base-error">{baseError}</div>}
|
2016-12-29 20:27:43 +00:00
|
|
|
<div className="fields">
|
|
|
|
<InputFieldWithIcon
|
|
|
|
{...fields.name}
|
|
|
|
autofocus
|
|
|
|
placeholder="Full Name"
|
|
|
|
/>
|
2021-04-12 13:32:25 +00:00
|
|
|
<InputFieldWithIcon {...fields.username} placeholder="Username" />
|
2016-12-29 20:27:43 +00:00
|
|
|
<InputFieldWithIcon
|
|
|
|
{...fields.password}
|
|
|
|
placeholder="Password"
|
|
|
|
type="password"
|
2021-04-12 13:32:25 +00:00
|
|
|
hint={[
|
|
|
|
"Must include 7 characters, at least 1 number (e.g. 0 - 9), and at least 1 symbol (e.g. &*#)",
|
|
|
|
]}
|
2016-12-29 20:27:43 +00:00
|
|
|
/>
|
|
|
|
<InputFieldWithIcon
|
|
|
|
{...fields.password_confirmation}
|
2020-12-10 21:09:05 +00:00
|
|
|
placeholder="Confirm password"
|
2016-12-29 20:27:43 +00:00
|
|
|
type="password"
|
|
|
|
/>
|
|
|
|
</div>
|
2020-12-09 01:45:08 +00:00
|
|
|
<div className="confirm-invite-button-wrap">
|
2021-04-12 13:32:25 +00:00
|
|
|
<Button
|
|
|
|
onClick={handleSubmit}
|
|
|
|
type="Submit"
|
|
|
|
className="button button--brand"
|
|
|
|
>
|
2020-12-09 01:45:08 +00:00
|
|
|
Submit
|
|
|
|
</Button>
|
|
|
|
</div>
|
2016-12-29 20:27:43 +00:00
|
|
|
</form>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Form(ConfirmInviteForm, {
|
|
|
|
fields: formFields,
|
|
|
|
validate,
|
|
|
|
});
|