fixes logout problem for view-restricted pages

Created new pull request. since the old one was against support/2.4.x - develop contains cms 3.0 code now.