1

This is truly bizarre.

I have a site page that uses parameters in the url to pass user, email and fullName values.

The page's init() then grabs those values and assigns them to variables.

If any of them is null, it attempts to retries a cookie and uses the cookie to pass the values into the variables.

The weird part is, we are seeing users (who are all local employees) use the page, submit and upon page reload, a different user's username is displayed on the page. The strange thing is, the new username is the username of the user to last submit a case using the site page.

Oh, and this only happens in PROD so I can't recreate it in an environment I can troubleshoot.

Below is the pertinent portion of the init function. I am trying to find out why the username string is being filled with a value of another user on a network.

username = GS_UtilityClass.getParam('user');
fullname = GS_UtilityClass.getParam('fullname');
useremail = GS_UtilityClass.getParam('email');
if(username == null || fullname == null || useremail == null){
    userCookie = ApexPages.currentPage().getCookies().get('userCookie');
    if(userCookie == null){
        userinfocookie uic = new userinfocookie();
        userCookie = new Cookie('userCookie',uic.getvalue(),null,-1,false);
        ApexPages.currentPage().setCookies(new Cookie[]{userCookie});
    }
    list<string> cookieElements = userCookie.getValue().split(';');
    map<string,string> userCookieMap = new map<string,string>();
    for(string v : cookieElements){
        userCookieMap.put(v.split(':')[0],v.split(':')[1]);
    }
    if(username == null) username = userCookieMap.get('user');
    if(fullname == null) fullname = userCookieMap.get('fullname');
    if(useremail == null) useremail = userCookieMap.get('email');

    userinfocookie newuic = new userinfocookie(username,fullname,useremail);
    userCookie = new Cookie('userCookie',newuic.getvalue(),null,-1,false);
    ApexPages.currentPage().setCookies(new Cookie[]{userCookie});
}else{
    userinfocookie uic = new userinfocookie(username,fullname,useremail);
    userCookie = new Cookie('userCookie',uic.getvalue(),null,-1,false);
    ApexPages.currentPage().setCookies(new Cookie[]{userCookie});
}

Submit is done via jsremoting and if successful the page is refreshed using window.location.href = baseUrl+'?submitted=true'; (submitted = true is used to set a boolean that controls the rendering of a Success page. baseURL is set thus: var baseUrl = window.location.toString();

0

Cookies are tied to the browser (or browser session). Any website you are viewing cannot access other browsers on your network (or other browsers on your computer). Try clearing cache.

1
  • This isn't a "clear your cache" kind of problem. Somehow, information is being transferred, one user submits a case, and when the next user submits a case, the previous user's username is somehow communicated to the next user. – imfromthepast Jul 28 '17 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.