mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 17:28:54 +00:00
5dd0b1cf64
* 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
21 lines
509 B
JavaScript
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 };
|