fleet/frontend/components/forms/ConfirmSSOInviteForm/ConfirmSSOInviteForm.jsx
John Murphy 12d2df1f9a Add SSO support to new user activation (#1504)
Closes #1502. This PR adds support for SSO to the new user creation process. An admin now has the option to select SSO when creating a new user.  When the confirmation form is submitted, the user is automatically authenticated with the IDP, and if successful, is redirected to the Kolide home page. Password authentication, password change and password reset are not allowed for an SSO user.
2017-05-10 11:26:05 -05:00

54 lines
1.6 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 ConfirmSSOInviteForm 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"
/>
</div>
<Button onClick={handleSubmit} type="Submit" variant="gradient">
Submit
</Button>
</form>
);
}
}
export default Form(ConfirmSSOInviteForm, {
fields: formFields,
validate,
});