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-06-24 20:42:29 +00:00
|
|
|
const formFields = ["name", "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,
|
|
|
|
|
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 (
|
2021-10-27 17:31:45 +00:00
|
|
|
<form className={className} autoComplete="off">
|
2017-01-06 00:01:17 +00:00
|
|
|
{baseError && <div className="form__base-error">{baseError}</div>}
|
2024-01-18 15:48:44 +00:00
|
|
|
<InputFieldWithIcon
|
|
|
|
|
{...fields.name}
|
|
|
|
|
autofocus
|
|
|
|
|
role="textbox"
|
|
|
|
|
label="Full name"
|
|
|
|
|
placeholder="Full name"
|
|
|
|
|
inputOptions={{
|
|
|
|
|
maxLength: "80",
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<InputFieldWithIcon
|
|
|
|
|
{...fields.password}
|
|
|
|
|
label="Password"
|
|
|
|
|
placeholder="Password"
|
|
|
|
|
type="password"
|
|
|
|
|
helpText="Must include 12 characters, at least 1 number (e.g. 0 - 9), and at least 1 symbol (e.g. &*#)"
|
|
|
|
|
/>
|
|
|
|
|
<InputFieldWithIcon
|
|
|
|
|
{...fields.password_confirmation}
|
|
|
|
|
label="Confirm password"
|
|
|
|
|
placeholder="Confirm password"
|
|
|
|
|
type="password"
|
|
|
|
|
/>
|
|
|
|
|
<Button
|
|
|
|
|
onClick={handleSubmit}
|
|
|
|
|
className="confirm-invite-button"
|
|
|
|
|
type="Submit"
|
|
|
|
|
variant="brand"
|
|
|
|
|
>
|
|
|
|
|
Submit
|
|
|
|
|
</Button>
|
2016-12-29 20:27:43 +00:00
|
|
|
</form>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Form(ConfirmInviteForm, {
|
|
|
|
|
fields: formFields,
|
|
|
|
|
validate,
|
|
|
|
|
});
|