Redirect on port change

This commit is contained in:
Ildar Kamalov 2019-02-19 18:04:23 +03:00
parent 8c406427af
commit 24154f0033
2 changed files with 8 additions and 4 deletions

View File

@ -82,7 +82,7 @@
}
.checkbox__input:disabled + .checkbox__label {
opacity: 0.7;
opacity: 0.6;
cursor: default;
}

View File

@ -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}`);
}