Skip to content

Commit

Permalink
Validate URL
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Feb 27, 2020
1 parent b2ecc4f commit bedac6d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import * as i18n from './translations';

import { ServiceNowActionConnector } from './types';
import { isUrlInvalid } from './validators';

import logo from './logos/servicenow.svg';

Expand All @@ -47,6 +48,10 @@ export function getActionType(): ActionTypeModel {
errors.apiUrl.push(i18n.SERVICENOW_API_URL_REQUIRED);
}

if (isUrlInvalid(action.config.apiUrl)) {
errors.apiUrl.push(i18n.SERVICENOW_API_URL_INVALID);
}

if (!action.secrets.username) {
errors.username.push(i18n.SERVICENOW_USERNAME_REQUIRED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ export const SERVICENOW_API_URL_REQUIRED = i18n.translate(
}
);

export const SERVICENOW_API_URL_INVALID = i18n.translate(
'xpack.siem.case.connectors.servicenow.invalidApiUrlTextField',
{
defaultMessage: 'URL is invalid',
}
);

export const SERVICENOW_USERNAME_LABEL = i18n.translate(
'xpack.siem.case.connectors.servicenow.usernameTextFieldLabel',
{
Expand Down

0 comments on commit bedac6d

Please sign in to comment.