From 24154f00334b99788a371ba371fec15eb1b14cb6 Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Tue, 19 Feb 2019 18:04:23 +0300 Subject: [PATCH] Redirect on port change --- client/src/components/ui/Checkbox.css | 2 +- client/src/helpers/helpers.js | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client/src/components/ui/Checkbox.css b/client/src/components/ui/Checkbox.css index 87e71793..9d483a5d 100644 --- a/client/src/components/ui/Checkbox.css +++ b/client/src/components/ui/Checkbox.css @@ -82,7 +82,7 @@ } .checkbox__input:disabled + .checkbox__label { - opacity: 0.7; + opacity: 0.6; cursor: default; } diff --git a/client/src/helpers/helpers.js b/client/src/helpers/helpers.js index def06646..22760bd5 100644 --- a/client/src/helpers/helpers.js +++ b/client/src/helpers/helpers.js @@ -142,12 +142,16 @@ export const getWebAddress = (ip, port = '') => { }; export const redirectToCurrentProtocol = (values) => { - const { protocol, hostname, hash } = window.location; + const { + protocol, hostname, hash, port, + } = window.location; const { enabled, port_https } = values; + const httpsPort = port_https !== 443 ? `:${port_https}` : ''; if (protocol !== 'https:' && enabled && port_https) { - const port = port_https !== 443 ? `:${port_https}` : ''; - window.location.replace(`https://${hostname}${port}/${hash}`); + window.location.replace(`https://${hostname}${httpsPort}/${hash}`); + } else if (protocol === 'https:' && enabled && port_https && port_https !== port) { + window.location.replace(`https://${hostname}${httpsPort}/${hash}`); } else if (protocol === 'https:' && (!enabled || !port_https)) { window.location.replace(`http://${hostname}/${hash}`); }