Django frontend detect if user is logged in
I use django
at backend and html/javascript
for frontend.
I am looking for a way to know in frontend if the user is logged in. If user is not logged in, upon pressing some buttons, the website shows a login overlay form.
By just checking whether sessionid
exists in the cookies or not you can find it out. But, the problem is SESSION_COOKIE_HTTPONLY
in django
settings is True
and I do not want to turn it off. Thus, the document.cookies
does not include the sesstionid
due to security reason. Is there still any way to find the user is logged in without contacting the backend?