Kentico

 

  1. Settings:

 

  1. Pages. Configure Link Url: https://crm2.diabetes.ca/site/UserLogin?NEXTURL=https://crm1.diabetes.ca/bbis_crmlive/canadianjournalofdiabetes  

 

BBIS

  1. Part CJD_Redirect

 

  1. Java script. Variable CJD_URL must be assigned the value pointing to https://www.canadianjournalofdiabetes.com:

<script type="text/javascript">

  

  let CJD_URL = "https://www.canadianjournalofdiabetes.com";

  let tpstoken = getAllUrlParams(window.location.href).tpstoken;

 

  if(typeof tpstoken === 'undefined'){

    window.location.href = CJD_URL;     

  }

  else{

     window.location.href = CJD_URL + "?tpstoken=" + encodeURIComponent(tpstoken);

  }

  

    

  function getAllUrlParams(url) {  

  let queryString = url ? url.split('?')[1] : window.location.search.slice(1);

  let obj = {};

  if (queryString) {

    queryString = queryString.split('#')[0];

    let arr = queryString.split('&');

 

    for (let i = 0; i < arr.length; i++) {      

      let a = arr[i].split('=');

      let paramName = a[0];

      let paramValue = typeof (a[1]) === 'undefined' ? true : a[1];

      paramName = paramName.toLowerCase();

      //if (typeof paramValue === 'string') paramValue = paramValue.toLowerCase();

      if (paramName.match(/\[(\d+)?\]$/)) {

        let key = paramName.replace(/\[(\d+)?\]/, '');

        if (!obj[key]) obj[key] = [];

        if (paramName.match(/\[\d+\]$/)) {

          let index = /\[(\d+)\]/.exec(paramName)[1];

           obj[key][index] = paramValue;

        } else {

           obj[key].push(paramValue);

        }

      } else {

        if (!obj[paramName]) {

           obj[paramName] = paramValue;

        } else if (obj[paramName] && typeof obj[paramName] === 'string'){

           obj[paramName] = [obj[paramName]];

           obj[paramName].push(paramValue);

        } else {

           obj[paramName].push(paramValue);

        }

      }

    }

  }

  return obj;

}

</script>