mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
* consistent error handling * Display server errors in InviteUserForm * Handle errors in Form component * Refactors query form * creates KolideAce component * Renders QueryForm from query page and manage hosts page * Moves ace editor and select targets dropdown to query form * Render base errors in Form HOC * LoginPage and ForgotPasswordPage server errors * Ensure unique key for user blocks * Adds base error to login form and forgot password form * Adds base error to query form * Adds base error to Pack Form * Adds errors to confirm invite form * Adds clearErrors action * clear errors when confirm invite page unmounts * Handle errors in the App Setting page * Handle server errors in the User Settings Page * Handle server errors in the User Management Page
67 lines
1.9 KiB
JavaScript
67 lines
1.9 KiB
JavaScript
import React, { Component, PropTypes } from 'react';
|
|
|
|
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';
|
|
|
|
const formFields = ['name', 'username', 'password', 'password_confirmation'];
|
|
const { validate } = helpers;
|
|
|
|
class ConfirmInviteForm extends Component {
|
|
static propTypes = {
|
|
baseError: PropTypes.string,
|
|
className: PropTypes.string,
|
|
fields: PropTypes.shape({
|
|
name: formFieldInterface.isRequired,
|
|
username: formFieldInterface.isRequired,
|
|
password: formFieldInterface.isRequired,
|
|
password_confirmation: formFieldInterface.isRequired,
|
|
}).isRequired,
|
|
handleSubmit: PropTypes.func.isRequired,
|
|
};
|
|
|
|
render () {
|
|
const { baseError, className, fields, handleSubmit } = this.props;
|
|
|
|
return (
|
|
<form className={className}>
|
|
{baseError && <div className="form__base-error">{baseError}</div>}
|
|
<div className="fields">
|
|
<InputFieldWithIcon
|
|
{...fields.name}
|
|
autofocus
|
|
placeholder="Full Name"
|
|
/>
|
|
<InputFieldWithIcon
|
|
{...fields.username}
|
|
iconName="username"
|
|
placeholder="Username"
|
|
/>
|
|
<InputFieldWithIcon
|
|
{...fields.password}
|
|
iconName="password"
|
|
placeholder="Password"
|
|
type="password"
|
|
/>
|
|
<InputFieldWithIcon
|
|
{...fields.password_confirmation}
|
|
iconName="password"
|
|
placeholder="Confirm Password"
|
|
type="password"
|
|
/>
|
|
</div>
|
|
<Button onClick={handleSubmit} type="Submit" variant="gradient">
|
|
Submit
|
|
</Button>
|
|
</form>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default Form(ConfirmInviteForm, {
|
|
fields: formFields,
|
|
validate,
|
|
});
|
|
|