fleet/frontend/components/forms/RegistrationForm/KolideDetails/helpers.js
Mike Stone 5dd0b1cf64 User registration submit (#490)
* Renames kolide_web_address to kolide_server_url

* API client for new user setup

* handle api response

* Do not allow logged in users to register
2016-11-21 15:22:14 -05:00

21 lines
509 B
JavaScript

import { size, startsWith } from 'lodash';
const validate = (formData) => {
const errors = {};
const { kolide_server_url: kolideWebAddress } = formData;
if (!kolideWebAddress) {
errors.kolide_server_url = 'Kolide web address must be completed';
}
if (kolideWebAddress && !startsWith(kolideWebAddress, 'https://')) {
errors.kolide_server_url = 'Kolide web address must start with https://';
}
const valid = !size(errors);
return { valid, errors };
};
export default { validate };