Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

@USER_NAME not refreshing when different user logs in

Hi there,

I came across something a little odd while customizing the html file referred to in the production.conf file with the jatos.brandingUrl parameter.

I have JATOS running on a server at my institution. All working well. So I decided to try to customize the welcome screen following the instructions listed here: https://www.jatos.org/Customize-JATOS-Home-Page.html

It's all working except for one thing... in the html code, I used that provided in the example above: <h2>Hi @USER_NAME!</h2>. It does generate an output when I log in, but it displays the username first used with that browser, no matter what username I log in with. I tried with different browsers. It works the very first time I log into Jatos. From the on, it keeps displaying the initial user name unless I empty the browser's cache.

Has someone come across this problem? Is there a way to ensure that @USER_NAME is refreshed to correspond to the currently logged in user?

Not an existential query (I can always just remove the @USER_NAME code and make the page less personal), but it's bugging me so I thought I'd see if someone out there can help me.

Thanks in advance!

Fabrice.

Buy Me A Coffee

Comments

  • Hi Fabrice,

    It seems there is an issue with your customized page's cache instructions. I'm not sure if this is a general problem or just with your page. I just checked on jatos.mindprobe.org and there it works with me (at least with Chrome). Where do you host your customization page? And what is your cache header (the one called Cache-Control) of the customized page (the request is on branding)?


    Best,

    Kristian

  • Hi Kristian (@kri) ,

    Thanks for your reply! Am not super agile with the intricacies of web pages but I did manage to find the bit about cache-control and it looks like yours (this is the info when I'm logging into JATOS, it's not the info just for the html I set jatos.brandingurl to):

    I'm hosting my customization page on Github. Followed the method described under point 5.b on this page: https://www.jatos.org/Customize-JATOS-Home-Page.html (can send you the actual URL in a private message if that helps).

    If I open only the html file I have on Github (that is, the address I indicate as jatos.brandinurl in the production.conf file), I get this:

    Does that help?

    Best,

    Fabrice

    Buy Me A Coffee

  • krikri
    edited July 2021

    Now I could reproduce the problem. Before I had Chrome's Dev Tools turned on and they turned off any caching 🙄.

    I checked the JATOS' code: The cache-control header is hard coded to max-age=3600 (1 hour) for the branding response (customized home page). The reason why we set it to 3600 s is, as I remember now, to keep JATOS from doing too many requests on the host (most likely GitHub) and hitting some rate limit there (there is max amount of requests one can do for free per hour on GitHub).

    I'll try to find a solution to invalidate the cache for freshly logged in users.

    EDIT: I made a fix. Will be part of the upcoming release 3.7.1.

    Best,

    Kristian

  • Hi Kristian (@kri) ,

    Great, many thanks for your reply! 👍️

    What you're describing makes a lot of sense. I guess I only noticed 'cause I'm managing JATOS on our server over here and I was trying out user management before I have colleagues using the service. I reckon most individual users just log in as themselves on their own computer anyway, so they wouldn't notice. Alternatively, I could always

    Still, thanks for making the adjustment in the next release!

    Best,

    Fabrice.

    Buy Me A Coffee

Sign In or Register to comment.