2020-10-08 17:15:05 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import Auth from '/imports/ui/services/auth';
|
2020-10-10 04:54:34 +08:00
|
|
|
|
2020-10-08 17:15:05 +08:00
|
|
|
|
|
|
|
export default function allowRedirectToLogoutURL() {
|
2024-03-07 01:28:18 +08:00
|
|
|
const ALLOW_DEFAULT_LOGOUT_URL = window.meetingClientSettings.public.app.allowDefaultLogoutUrl;
|
2020-10-10 05:10:12 +08:00
|
|
|
const protocolPattern = /^((http|https):\/\/)/;
|
2020-10-08 17:15:05 +08:00
|
|
|
if (Auth.logoutURL) {
|
2020-10-10 04:54:34 +08:00
|
|
|
// default logoutURL
|
2020-10-10 05:10:12 +08:00
|
|
|
// compare only the host to ignore protocols
|
|
|
|
const urlWithoutProtocolForAuthLogout = Auth.logoutURL.replace(protocolPattern, '');
|
|
|
|
const urlWithoutProtocolForLocationOrigin = window.location.origin.replace(protocolPattern, '');
|
|
|
|
if (urlWithoutProtocolForAuthLogout === urlWithoutProtocolForLocationOrigin) {
|
|
|
|
return ALLOW_DEFAULT_LOGOUT_URL;
|
|
|
|
}
|
2020-10-08 17:15:05 +08:00
|
|
|
|
|
|
|
// custom logoutURL
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
// no logout url
|
|
|
|
return false;
|
|
|
|
}
|