Skip to main content
Commonmark migration
Source Link

For performance reasons I'm setting some user info in the local storage of the client/navigator when he logs in.

It allows me to tune the pages appearance (show/hide menus, display the name of the user,etc...) whether the user is logged or not.

This works perfectly as long as there is no session desynchronization between the client and the server. For instance if the server session ids are flushed, the client has no way to guess it. As a consequence, the user cannot access the "private" content (redirection to the home page in my case) although the page appearance looks like the user is still connected/identified.

A first solution that came to me is to detect the redirection on the client side (javascript), erase the local information regarding the user and modify the website appearance to correspond to a disconnected user.

My question is

Is there another smarter way to detect session id invalidation from the client side?

Subsidiary question

Are there side effects I'm missing with the "page redirection" detection solution?

For performance reasons I'm setting some user info in the local storage of the client/navigator when he logs in.

It allows me to tune the pages appearance (show/hide menus, display the name of the user,etc...) whether the user is logged or not.

This works perfectly as long as there is no session desynchronization between the client and the server. For instance if the server session ids are flushed, the client has no way to guess it. As a consequence, the user cannot access the "private" content (redirection to the home page in my case) although the page appearance looks like the user is still connected/identified.

A first solution that came to me is to detect the redirection on the client side (javascript), erase the local information regarding the user and modify the website appearance to correspond to a disconnected user.

My question is

Is there another smarter way to detect session id invalidation from the client side?

Subsidiary question

Are there side effects I'm missing with the "page redirection" detection solution?

For performance reasons I'm setting some user info in the local storage of the client/navigator when he logs in.

It allows me to tune the pages appearance (show/hide menus, display the name of the user,etc...) whether the user is logged or not.

This works perfectly as long as there is no session desynchronization between the client and the server. For instance if the server session ids are flushed, the client has no way to guess it. As a consequence, the user cannot access the "private" content (redirection to the home page in my case) although the page appearance looks like the user is still connected/identified.

A first solution that came to me is to detect the redirection on the client side (javascript), erase the local information regarding the user and modify the website appearance to correspond to a disconnected user.

My question is

Is there another smarter way to detect session id invalidation from the client side?

Subsidiary question

Are there side effects I'm missing with the "page redirection" detection solution?

added 12 characters in body
Source Link
Nitseg
  • 121
  • 4

For performance reasons I'm setting some user info in the local storage of the client/navigator when he logs in.

It allows me to tune the pages appearance (show/hide menus, display the name of the user,etc...) whether the user is logged or not.

This works perfectly as long as there is no session desynchronization between the client and the server. For instance if the server session ids are flushed, the client has no way to guess it. As a consequence, the user cannot access the "private" content (redirection to the home page in my case) although the page appearance looks like the user is still connected/identified.

A first solution that came to me is to detect the redirection on the client side (javascript), erase the local information regarding the user and modify the website appearance to correspond to a disconnected user.

My question is

Is there another smarter way to detect session id invalidation from the client side?

Subsidiary question

Are there side effects I'm missing with the page redirection"page redirection" detection solution?

For performance reasons I'm setting some user info in the local storage of the client/navigator when he logs in.

It allows me to tune the pages appearance (show/hide menus, display the name of the user,etc...) whether the user is logged or not.

This works perfectly as long as there is no session desynchronization between the client and the server. For instance if the server session ids are flushed, the client has no way to guess it. As a consequence, the user cannot access the "private" content (redirection to the home page in my case) although the page appearance looks like the user is still connected/identified.

A first solution that came to me is to detect the redirection on the client side (javascript), erase the local information regarding the user and modify the website appearance to correspond to a disconnected user.

My question is

Is there another smarter way to detect session id invalidation from the client side?

Subsidiary question

Are there side effects I'm missing with the page redirection solution?

For performance reasons I'm setting some user info in the local storage of the client/navigator when he logs in.

It allows me to tune the pages appearance (show/hide menus, display the name of the user,etc...) whether the user is logged or not.

This works perfectly as long as there is no session desynchronization between the client and the server. For instance if the server session ids are flushed, the client has no way to guess it. As a consequence, the user cannot access the "private" content (redirection to the home page in my case) although the page appearance looks like the user is still connected/identified.

A first solution that came to me is to detect the redirection on the client side (javascript), erase the local information regarding the user and modify the website appearance to correspond to a disconnected user.

My question is

Is there another smarter way to detect session id invalidation from the client side?

Subsidiary question

Are there side effects I'm missing with the "page redirection" detection solution?

Source Link
Nitseg
  • 121
  • 4

How to detect the server has logged out the user from the client side?

For performance reasons I'm setting some user info in the local storage of the client/navigator when he logs in.

It allows me to tune the pages appearance (show/hide menus, display the name of the user,etc...) whether the user is logged or not.

This works perfectly as long as there is no session desynchronization between the client and the server. For instance if the server session ids are flushed, the client has no way to guess it. As a consequence, the user cannot access the "private" content (redirection to the home page in my case) although the page appearance looks like the user is still connected/identified.

A first solution that came to me is to detect the redirection on the client side (javascript), erase the local information regarding the user and modify the website appearance to correspond to a disconnected user.

My question is

Is there another smarter way to detect session id invalidation from the client side?

Subsidiary question

Are there side effects I'm missing with the page redirection solution?