From 158f2f6100085a1c9001f06383c02d06721a256f Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Thu, 21 Feb 2019 19:16:09 +0300 Subject: [PATCH] Fixed port validation --- client/src/helpers/form.js | 2 +- client/src/helpers/helpers.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/helpers/form.js b/client/src/helpers/form.js index 58d11ba8..1f0a339a 100644 --- a/client/src/helpers/form.js +++ b/client/src/helpers/form.js @@ -63,7 +63,7 @@ export const isPositive = (value) => { }; export const port = (value) => { - if (value && (value < 80 || value > 65535)) { + if ((value || value === 0) && (value < 80 || value > 65535)) { return form_error_port_range; } return false; diff --git a/client/src/helpers/helpers.js b/client/src/helpers/helpers.js index 2ac0afe9..eb7c7db2 100644 --- a/client/src/helpers/helpers.js +++ b/client/src/helpers/helpers.js @@ -195,7 +195,7 @@ export const redirectToCurrentProtocol = (values, httpPort = 80) => { if (protocol !== 'https:' && enabled && port_https) { checkRedirect(`https://${hostname}${httpsPort}/${hash}`); - } else if (protocol === 'https:' && enabled && port_https && port_https !== port) { + } else if (protocol === 'https:' && enabled && port_https && port_https !== parseInt(port, 10)) { checkRedirect(`https://${hostname}${httpsPort}/${hash}`); } else if (protocol === 'https:' && (!enabled || !port_https)) { window.location.replace(`http://${hostname}:${httpPort}/${hash}`);