How to add a class to the body element?

Ok, as i understood you want to send your data over to the HTML-WINDOW (HTML-CODE-WORLD), which seems to be your favourite one. Where you want to genrate your own custom HTML+CSS-CODE.

As i already told, there are several options.
a) HTML-COMPONENT
b) Custom-Element
c) Inside Dashboard (Custom-Code)

It seems like you are not really a beginner in coding, just the VELO-WORLD is new for you, but not coding at all. You seems to know how to work with HTML and the DOM.

At least i can see, that you have already some coding skills, or you understand things very fast.

Your steps for your solution would be…

  1. User Logs in

  2. Authentication-process running (backend or frontend)

  3. You get response if user is logged-in or not (boolean-value → true/false)

  4. Now comes the more difficult part, sending it over to the HTML-WORLD

  5. This for i will use a HTML-Component in this example…

You will have to take a look onto this example, wich will show you the right way of how to do it and how to bring your wished function in action…

https://www.wix.com/velo/reference/$w/htmlcomponent/onmessage

Read more about the HTML-Component in the introduction of the related API-Docs.

ATTENTION: To be able to use the HTML-Component, you will need to have a PREMIUM Wix-Site. It won’t work on FREE-Wixsites.

The same you will be able to generte, by using a CUSTOM-ELEMENT.
Custom-Element will be the better option, but HTML-Component also should do the trick.

Good luck!!!