1// Function to create a 'ssoUUID' cookie 2function setCookie(name, value, days) { 3 const date = new Date(); 4 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); // Set cookie expiration 5 const expires = "expires=" + date.toUTCString(); 6 document.cookie = `${name}=${value}; ${expires}; path=/`; // Set cookie with expiration and path 7} 8 9// Function to check if the 'ssoUUID' cookie exists 10function getCookie(name) { 11 const nameEQ = name + "="; 12 const cookies = document.cookie.split(';'); 13 14 for (let cookie of cookies) { 15 cookie = cookie.trim(); // Trim any leading spaces 16 17 // Check if this cookie starts with 'name=' 18 if (cookie.indexOf(nameEQ) === 0) { 19 return cookie.substring(nameEQ.length, cookie.length); 20 } 21 } 22 23 return null; // Return null if the cookie doesn't exist 24} 25 26// Function to generate a UUID 27function __generateUUID() { 28 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { 29 const r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); 30 return v.toString(16); 31 }); 32} 33 34function __setSSOCookie() { 35 const cookieName = "ssoUUID";
36 let cookieValue = getCookie(cookieName); 37 38 if (!cookieValue) { 39 // If 'ssoUUID' cookie doesn't exist, create one 40 cookieValue = __generateUUID(); 41 setCookie(cookieName, cookieValue, 365); // Cookie will last for 1 year 42 //console.log("New ssoUUID cookie created with UUID:", cookieValue); 43 } else { 44 //console.log("ssoUUID cookie already exists with value:", cookieValue); 45 } 46} 47 48__setSSOCookie();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.