How to make my blocks switch to another block when session was set?
You can do this in code:

if (\Drupal::currentUser()-&gt;isAnonymous()) {}


Or in block layout by configuring the visibility of roles:

When the user has the following roles


Anonymous user
Authenticated user
Administrator


The first block for anonymous users and the second block for authenticated users.