Fixed port validation

This commit is contained in:
Ildar Kamalov 2019-02-21 19:16:09 +03:00
parent 8e993cd788
commit 158f2f6100
2 changed files with 2 additions and 2 deletions

View file

@ -63,7 +63,7 @@ export const isPositive = (value) => {
}; };
export const port = (value) => { export const port = (value) => {
if (value && (value < 80 || value > 65535)) { if ((value || value === 0) && (value < 80 || value > 65535)) {
return <Trans>form_error_port_range</Trans>; return <Trans>form_error_port_range</Trans>;
} }
return false; return false;

View file

@ -195,7 +195,7 @@ export const redirectToCurrentProtocol = (values, httpPort = 80) => {
if (protocol !== 'https:' && enabled && port_https) { if (protocol !== 'https:' && enabled && port_https) {
checkRedirect(`https://${hostname}${httpsPort}/${hash}`); 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}`); checkRedirect(`https://${hostname}${httpsPort}/${hash}`);
} else if (protocol === 'https:' && (!enabled || !port_https)) { } else if (protocol === 'https:' && (!enabled || !port_https)) {
window.location.replace(`http://${hostname}:${httpPort}/${hash}`); window.location.replace(`http://${hostname}:${httpPort}/${hash}`);