Skip to content

Commit

Permalink
- client: remove wildcard from domain validation
Browse files Browse the repository at this point in the history
  • Loading branch information
IldarKamalov committed Jan 25, 2021
1 parent b1aec04 commit 0647ab4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions client/src/helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export const R_CIDR_IPV6 = /^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([

export const R_DOMAIN = /^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}$/;

export const R_SERVER_NAME = /^(\*\.)?[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}$/;

export const R_PATH_LAST_PART = /\/[^/]*$/;

// eslint-disable-next-line no-control-regex
Expand Down
4 changes: 2 additions & 2 deletions client/src/helpers/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
STANDARD_WEB_PORT,
UNSAFE_PORTS,
R_CLIENT_ID,
R_SERVER_NAME,
R_DOMAIN,
} from './constants';
import { getLastIpv4Octet, isValidAbsolutePath } from './form';

Expand Down Expand Up @@ -89,7 +89,7 @@ export const validateServerName = (value) => {
return undefined;
}
const formattedValue = value ? value.trim() : value;
if (formattedValue && !R_SERVER_NAME.test(formattedValue)) {
if (formattedValue && !R_DOMAIN.test(formattedValue)) {
return 'form_error_server_name';
}
return undefined;
Expand Down

0 comments on commit 0647ab4

Please sign in to comment.