Correct bug when user goes directly to a restricted page and is not redirect to login page.