Use handleSessionResponse to perform VPN redirect

This commit is contained in:
Colby Gutierrez-Kraybill 2023-02-09 19:04:37 -05:00
parent 21a795cd0b
commit d343b514ba

View file

@ -65,22 +65,20 @@ module.exports.setStatus = status => ({
}); });
const handleSessionResponse = (dispatch, body) => { const handleSessionResponse = (dispatch, body) => {
console.log(window.location.pathname);
if (typeof body === 'undefined') return dispatch(module.exports.setSessionError('No session content')); if (typeof body === 'undefined') return dispatch(module.exports.setSessionError('No session content'));
if ( if (
body.vpn_required &&
banGoodListPaths.every(goodPath => window.location.pathname.indexOf(goodPath) === -1)
) {
window.location = '/vpn_required/';
return;
} else if (
body.user && body.user &&
body.user.banned && body.user.banned &&
banGoodListPaths.every(goodPath => window.location.pathname.indexOf(goodPath) === -1) banGoodListPaths.every(goodPath => window.location.pathname.indexOf(goodPath) === -1)
) { ) {
window.location = '/accounts/banned-response/'; window.location = '/accounts/banned-response/';
return; return;
} else if (
body.flags &&
body.flags.vpn_required &&
banGoodListPaths.every(goodPath => window.location.pathname.indexOf(goodPath) === -1)
) {
window.location = '/vpn_required/';
return;
} else if ( } else if (
body.flags && body.flags &&
body.flags.must_complete_registration && body.flags.must_complete_registration &&